Accordion Menu

Permalink
Hi all,
I want to implement my accordion menu to my new theme. Its coding like below;

<h3 class="accordionButton tabbing">ROOT MENU1</h3>
<div class="accordionContent tabbingContent">
<ul>
<li><a href="#" title="Subtitle 1">Subtitle 1</a></li>
<li><a href="#" title="Subtitle 2">Subtitle 2</a></li>
</ul>
</div>

<h3 class="accordionButton tabbing on">ROOT MENU2</h3>
<div class="accordionContent tabbingContent show">
<ul>
<li><a href="#" title="Subtitle 1">Subtitle 1</a></li>
<li><a href="#" title="Subtitle 2">Subtitle 2</a></li>
</ul>
</div>




I have created a new autonav theme but could not fit the code as i want. You can find the autonav view.php as below.
Could you please help me to figure out ?

Thanks.

echo '<ul class="nav">'; //opens the top-level menu

foreach ($navItems as $ni) {

echo '<li class="' . $ni->classes . '">'; //opens a nav item

echo '<a href="' . $ni->url . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . $ni->name . '</a>';

if ($ni->hasSubmenu) {
echo '<ul>'; //opens a dropdown sub-menu
} else {
echo '</li>'; //closes a nav item
echo str_repeat('</ul></li>', $ni->subDepth); //closes dropdown sub-menu(s) and their top-level nav item(s)
}
}

echo '</ul>'; //closes the top-level menu

 
mhawke replied on at Permalink Reply
mhawke
It's pretty tough to diagnose this without your whole view.php and your css. Can you attach some supporting files for us to have a look at?

Also, you don't say what the problem is. Saying 'could not fit the code' isn't specific enough.

More info = better, faster answers.

We also need to see more code to convince ourselves that you've tried to do this yourself and need our help to 'tweak' it. Otherwise you should post this under 'Jobs' and pay someone to build it for you.

Sorry if I seem to be in a pissy mood.
umutguncan replied on at Permalink Best Answer Reply
Sorry about less info. I can figure out the autonav system and implemented my menu as below :

Thanks




foreach ($navItems as $ni)
{
if ($ni->level == 1)
{
echo '<h3 class="accordionButton tabbing">';
echo $ni->name;
echo '</h3>';

if ($ni->hasSubmenu)
{
echo '<div class="accordionContent tabbingContent">';
echo '<ul>';
}
}
if ($ni->level == 2)
{
echo '<li>';
echo '<a href="' . $ni->url . '" target="' . $ni->target . '" >' . $ni->name . '</a>';


echo '</li>';
if($ni->isLast){
echo '</ul>';
echo '</div>';
}
}



}
mhawke replied on at Permalink Reply
mhawke
How are you setting $navItems?

Once again, if you could attach your view.php and any separate stylesheet it might be using, we could help you move forward. You will need to rename your view.php to view.txt in order to attach it to this forum.
umutguncan replied on at Permalink Reply 1 Attachment
mhawke,

My last msg was the solution. You can see my view file in the attachment.
mhawke replied on at Permalink Reply
mhawke
Sorry for the misunderstanding.

Great to see you found the solution.
playhouse replied on at Permalink Reply
Hi umutguncan

Would you be able to elaborate on your vertical accordion nav solution please?

Thanks