|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
classes and array declaration problem
I made a normal slide out menu in javascript.
Now i am using php to make sure i can put it on all pages and all. so I made a class called menu item. <? php class menuitem { var $name; //name $submenu = array();//array of submenu items. var $link; //link var $currentposition; var $id var $linkinfo; function menuitem($name, $submenu, $link,$prevposition,$id,$linkinfo) { $this->name = $name; $this->link = $link; for($i =0; $i<submenu; i++) { $this->submenu[i] = new submenuitem(""," "); } $this->currentposition = $prevposition + 40; $this->id =$id; $this->linkinfo; } function getposition() { return $this->currentpostion; } function ypslideout() { $size = 50*sizeof($this->submenu); print("new ypSlideOutMenu(\"$this->name\"".", \"right\", 120,$this->currentposition , 150, $size);\n"); } function link() { print("<a id=\"$this->id\""." href=\"$this->link\""." onmouseover=\"ypSlideOutMenu.showMenu(\'$this->name\')\""." onmouseout=\"ypSlideOutMenu.hideMenu(\'$this->name\')\">"."$linkinfo"."</a><br>\n"); print("<br>"); } function submenulink($array, $name, $link) { $this->submenu[$array]->setlink($name, $link); } function createsubmenu() { if(sizeof($this->submenu)!=0) { $divid1 = $name."container"; $divid2 = $name."content"; print("<div id = \"$divid1\">\n"); print(" <div id=\"$divid2\"." class=\"menu\">\n"); print(" <div class=\"options\">\n"); for(int i = 0; print(" <a href="$this->submenu[i]->getlink()"".">$this->submenu[i]->getname()</a>\n"); print(" </div>\n"); print(" </div>\n)"; } }?> now i am getting a parse error on line 3. I wonder if something is wont with my array declaration. Last edited by esha : June 19th, 2003 at 10:01 AM. |
|
#2
|
||||
|
||||
|
Put your code in PHP tags so folks can actually read it while you're at it...
|
|
#3
|
|||
|
|||
|
You're mixing your javascript and php code. Take a closer look at line three. There's only two 'words'...php doesn't have a var statement.
|
|
#4
|
||||
|
||||
|
Quote:
Actually - it does, he/she is intializing/defineing the attributes, thats how to do it in php. The problem is initializing the att to array() - initialize it to nothing then asign it in the constructor... |
|
#5
|
|||
|
|||
|
can you please rexplain this to me?
I am not understanding. |
|
#6
|
||||
|
||||
|
The explaination is to move your question to the PHP forum, and everything will work again
|
|
#7
|
|||
|
|||
|
Crap. Don't post on your birthday when you get back from the bar...
|
![]() |
| Viewing: Dev Shed Forums > Other > Dev Shed Lounge > classes and array declaration problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|