I've done this a couple of different ways. When I had a static menu, I
put this into my layout:
<?php echo $this->renderElement('menu')?>
I saved menu.thtml in my elements folder
<ul>
<li>Menu Item 1</li>
<li>Menu Item 2</li>
</ul>
When I needed dynamic content, my menu.thtml looked like this:
<ul>
<?php foreach($menu as $pages): ?>
<li><?= $html->link($pages['Webpage']['name'],
"/webpages/{$pages['Webpage']['name']}"); ?></li>
<?php endforeach; ?>
</ul>
and put this in my controller:
$this->set('menu', $this->Webpage->findAll());
The trick with this is to make sure you set 'menu' in your controller
for any function that uses a layout that calles renderElement('menu').
You could probably also test for $menu and only render it if menu has
been set.
There are probably other/better ways to do this, but maybe this will
help you get started.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---