Well first, it sounds like you want to create a component
Class NavComponent extends Object {}
It sounds like from your message that all 3 navs are on the same page,
you just want to be able to control the links that are in each. Am I
right?
1. What I would do in that case is in the initialize or startup
function of the component is import the nav model
App::Import('Model','NavMenu');
2. Create 3 arrays (nav_1, nav_2, nav_3)
3. Populate each array with their respective items
<?php
$nav_1[] = array(
'title' => 'Home',
'controller' => 'pages',
'action' => 'display',
'id' => 1
)
?>
4. Then set those variables ($this-
>set(compact('nav_1','nav_2','nav_3'))
5. Then in your layout, in each section where the nav is supposed to
be
ex. Nav_1
<ul>
<?php foreach ($nav_1 as $item): ?>
<li><?php echo $html->link($item['title'],array('controller'=>
$item['controller'],'action'=>$item['action'],$item['id'])) ?></li>
<?php endforeach ?>
</ul>
Does that help?
On Nov 10, 5:31 pm, Rob Wilkerson <[EMAIL PROTECTED]> wrote:
> I'm so new to Cake that I'm honestly not even sure how to best ask
> this question (much less search to see whether it's been asked), so
> I'm going to describe what I have and allow the question of how best
> to achieve the result to be implied.
>
> I have a layout (my default layout) that includes 3 different
> navigation menus (primary, secondary, tertiary). Those menus are data
> driven - I have a nav_menus table that hasAndBelongsToMany
> nav_menu_items. I'd like to populate those menu instances dynamically
> in each place where they belong on the layout. I'd like to share the
> logic that will retrieve the items based on the menu and use that to
> output the expected markup:
>
> <ul class="alternate-nav">
> <li class="first">Home</li>
> <li>Directions</li>
> <li class="last">Contact</li>
> </ul>
>
> I'm not sure where to look to get started. I have dug around some, but
> I haven't seen anything that seems to address this particular need in
> a way that I can digest it as such.
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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?hl=en
-~----------~----~----~----~------~----~------~--~---