Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Twitter
Powered by Vanilla. Made with Bootstrap.
Theme built by Kasper Kronborg Isager
non clickable menu item
  • OK just one more question :) (i hope)
    is it posible to create a menu item that is not related to a page (does not have content and is not clickable).
    i just want it to be a category for a dropdown options but you can not click on the menu item for it self (just the sub categories have page content).
    hope i made my self clear..
  • what i aim to acomplish in html code should look like this :
    <ul>
    <li><a href="#">about us</a>
    <ul>
    <li><a href="story.html">our story</a></li>
    <li><a href="clients.html">our clients</a></li>
    </ul>
    </li>
    </ul>

  • hi,

    i didn't got my 10eur donation yet, or are you planning to hit the donation button multiple times ;)

    i would do it like this:
    <ul class="menu">
    <li><a href="#">about us</a>
    <?php
    foreach($feindura->createMenu('category',2,'ul.menu') as $item) {
    echo $item['item'];
    }
    ?>
    </li>
    </ul>


    so basically, set the first link manually and just create a menu in the drop down part..
  • did you get it now? :D
    only problem with this solution is that i need it to work with the dinamic menu and sub menu from the previuse discation
  • yeah i got it thanks, you're now the first official donor!

    if you want to combine the dynamic and the manual menu i would do it like this:
     
    <ul class="menu">
    <?php
    foreach($feindura->createMenu('category',0) as $item) {
     
    echo '<li>'.$item['link'];
     
    foreach ($feindura->createSubMenuOfPage($item['pageId'],'ul.menu') as $subItem) {
    echo $subItem['startTag'];
    echo $subItem['link'];
     
     
    foreach ($feindura->createSubMenuOfPage($subItem['pageId'],'ul.menu') as $subsubItem) {
    echo $subsubItem['menuItem'];
    }
     
    echo $subItem['endTag'];
    }
     
    echo '</li>';
    }
    ?>
    <li><a href="#" onclick="return false;">about us</a>
    <?php
    foreach($feindura->createMenu('category',2,'ul.menu') as $item) {
    echo $item['item'];
    }
    ?>
    </li>
    </ul>


    but be aware that then the <li> won't get the 'active' class, only the <a>. This you have to do then manually.
  • glad to be the official donor :)
    this solution works fine i guess, but there are 2 questions :
    1. how can i set the parent menu category item to active when clicking on one of its sub categories?

    2. is it posible to control the order of top menu items when working with both methods?
    lets say i want the home page to be first after creating it dynamicly when creating a new page, and after that i want the manual about category followed by another dynamic menu item with no category..
  • hi again.

    1. to do that you would need to check whethere or not you are in the right category like this:
    <?php
    // check if your in the sub category of the manual sub menu
    $menuActive = ($feindura->category == 2) ? ' class="active"' : '';
    ?>
    <li><a href="#" onclick="return false;"<?php echo $menuActive; ?>>about us</a>
    <?php
    foreach($feindura->createMenu('category',2,'ul.menu') as $item) {
    echo $item['item'];
    }
    ?>
    </li>


    2. for this i don't know a good solution. i would do a total dynamic one, with pages and sub categories. then i wouldn't show a link for the non-clickable page, but only the title.
    so basically you create a page for e.g. "about" just as a placeholder without link. but link a specific sub category.

    i Also included the stuff from above.
    foreach($feindura->createMenu('category',0,'ul.menu') as $item) {
     
     
    // 23 is the number of you placeholder site
    if($item['pageId'] == 23) {
     
    // check if you are in the sub category of the page 23
    $menuActive = ($feindura->category == 2) ? ' class="active"' : '';
     
    echo '<li'.$menuActive.'>';
     
    // then we just show the title of the page as text, without link.
    echo $item['title'];
     
    // all other pages
    } else {
    echo $item['startTag'];
    echo $item['link'];
    }
     
    foreach ($feindura->createSubMenuOfPage($item['pageId'],'ul.menu') as $subItem) {
    echo $subItem['startTag'];
    echo $subItem['link'];
     
     
    foreach ($feindura->createSubMenuOfPage($subItem['pageId'],'ul.menu') as $subsubItem) {
    echo $subsubItem['menuItem'];
    }
     
    echo $subItem['endTag'];
    }
     
    echo $item['endTag'];
    ?>