Hi Gobblez,

The dumbed down version of this is in this google thread, 2nd post. The
paste, which I now see does exist, is slightly obsolete in the way it
is coded - but will still work.

I'm not entirely sure where you questions begin :o), so I'll start
where I can answer, If I say something you already know or understand
please skip to the next q:

1) $this->Menu->controller = &$this;
This sets the variable controller on the object Menu to be the
controller - it is passed by reference (so any changes that the Menu
method init does to the variable $controller as reflected immediately
in the controller).
After you have this working, try this mini experiment: delete the "&".
You will notice that it stops working - google for "Pass by reference"
for more info

2) name
This is the name of the controller. It isn't used in the component, but
it could easily be used to check/eliminate links to the current
controller. This variable is set by Cake, unless overriden in the
controller.

3) $this->Menu->init($this->name);
In the paste code, the init method ONLY sets the variable MenuItems on
the controller.

4) BeforeFilter
You can, if you choose, define an array of beforeFilter methods to be
run.

5) echo "<li>".$htm....
Your defenition of the array elements is perfect. Your concerns are
absolutely spot on, and in fact the paste code fails this test every
time. In the second post of this thread it was modified to be:
echo "<li>".$html->link($Menu[0], $Menu[1], strtolower($this->name)
== strtolower($Menu[0]) ? Array('class'=>'active') : NULL)."</li>";

6)name again
The PHP4 fix, only changes the case of the variable it is set by cake
to be the name of the controller - echo it out if in doubt.

After a little refining, I think I'll put it on the wiki ;)

Cheers,

AD7six
Looking for CakePHP info?
Find it faster here: http://www.cakephp.org/search/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to