How do I make two seperate menus for one site?

Feed 6 posts, 2 voices

Avatar
24 posts

On the layout there are two seperate menus for the site. One is a top level nav with sublinks and then there is a second level with sublinks also. Anyone have an idea of how I can pull this off with frogcms?

 
Avatar
180 posts
<ul class="top-level">
<?php foreach($this->find('/')->children() as $item): ?>
<li <?php if(in_array($this->slug, explode('/', $item->url))) echo 'class="current"'; ?>><?php echo $item->link(); ?></li>
<?php if($child = $this->children()): ?>
<ul class="two-level">
<?php foreach($child as $subitem): ?>
<li <?php if(in_array($this->slug, explode('/', $subitem->url))) echo 'class="current"'; ?>><?php echo $subitem->link(); ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</ul>

And then you may add 3 level.

 
Avatar
24 posts

The menus are in to different areas of the layout. :(

 
Avatar
180 posts

Hm… Use $this->parent(1)->children() to get childrens of 1 level menu.

In header maybe:

<ul class="top-level">
<?php foreach($this->find('/')->children() as $item): ?>
<li <?php if(in_array($this->slug, explode('/', $item->url))) echo 'class="current"'; ?>><?php echo $item->link(); ?></li>
<?php endforeach; ?>
</ul>

In sidebar:

<?php if($child = $this->level(1)->children()): ?>
<ul class="two-level">
<?php foreach($child as $subitem): ?>
<li <?php if(in_array($this->slug, explode('/', $subitem->url))) echo 'class="current"'; ?>><?php echo $subitem->link(); ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</ul>

But for this download this Frog version

 
Avatar
24 posts

Guess I need to show you what it’s suppose to render. linktext

The top post is rendered by frogcms. The second navlist isn’t. At least not yet. That is what I’m trying to do. :)

Is the cms download link you gave different from what is available on the website?

 
Avatar
180 posts

See INFO/FrogCMS_0.9.5_RU1_changes.txt. Chenges are small and chenged parent() method.

Do a hidden page with slug, maybe, /other_menu/ and do another struct.

Use:

<?php foreach($this->find('/other_menu/')->children() as $item): ?> ...

My English is ugly :(

 
Avatar
24 posts

That worked!!!!!!! Thank you so much!