Im working on a project that was originally developed by another PHP
developer. He created a helper class to create the main menu in such a
fashion...

Function A. Would actually add the menu items to an array with the
Anchor Tag, URL and a Key

Function B. Would iterate through each item in the array and create
the link with the Anchor Tag and URL, it would also check if the
passed "Selected" item was equal to the key for each array item, if
so, it puts an "Active" CSS class on it.

This system works using $this->renderElement in the view file as the
element file contains the functions that adds each menu item and
finally does a print() on the menu function with the selected item
being passed to it.

My current project requires that for some of the menu items they have
sub items that are pulled from the DB. I have found that I cant call a
function from a model from the element file because I get an
"unrecognized function in a view file" or something similar.

Is there a way I can call a model function from the element or
otherwise dynamically add menu items from the DB before I do the
renderElement?

The element looks like this...

$mainMenu->addMenuItem("News and Events","news","/news");
$mainMenu->addMenuItem("About","about","/about");
$mainMenu->addMenuItem("Locations","locations","/locations");
$mainMenu->addMenuItem("Contact","contacts","/contact");
print($mainMenu->showMenu($selected));

addMenuitem is the function within the helper class that adds items
and showMenu, well thats self explanitory...

Sorry this post was long and verbose, just wanted to make sure that
anyone who looks is on the same page.

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to