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
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
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>';
}
}
}
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>';
}
}
}
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.
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.
mhawke,
My last msg was the solution. You can see my view file in the attachment.
My last msg was the solution. You can see my view file in the attachment.
Sorry for the misunderstanding.
Great to see you found the solution.
Great to see you found the solution.
Hi umutguncan
Would you be able to elaborate on your vertical accordion nav solution please?
Thanks
Would you be able to elaborate on your vertical accordion nav solution please?
Thanks
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.