Topic: [SOLVED] 2 levels menu...
I would like to design a 2 levels menu...
The html code must be like that:
<div>
<h3>
<a href="http://page1.html">
Page 1
</a>
</h3>
<ul>
<li>
<a href="http://sub-page1.html">
Sub page 1
</a>
</li>
<li>
<a href="http://sub-page2.html">
Sub page 2
</a>
</li>
</ul>
</div>And here come's my code (doesn't work):
<?php $subPageId = explode('/', $_SERVER['REQUEST_URI']); $level2=$subPageId[1]; $level3=$subPageId[2]; $level4=$subPageId[3]; ?>
<div>
<h3><a<?php echo url_match('/') ? ' class="current"': ''; ?> href="<?php echo URL_PUBLIC; ?>">Home</a></h3>
</div>
<?php foreach($this->find('/')->children() as $menu): ?>
<div>
<h3><?php echo $menu->link($menu->title, (in_array($menu->slug, explode('/', $this->url)) ? ' class="current"': null)); ?></h3>
<?php if ($level2 != '' && strpos($_SERVER['REQUEST_URI'],$menu->slug) == true) : ?>
<?php $page2 = $this->find($level2); ?>
<ul><!-- child level {2} -->
<?php foreach ($page2->children(array()) as $menu2): ?>
<li><?php echo $menu2->link(); ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>Is somenone can help me
Last edited by oweb (2010-03-04 22:10)
http://wolfcms.office-web.net/

