PHP Scripts Development » Discuss our Web Development Tutorials

Dynamic navigation list - missing index

(6 posts)

Great offers not only for geeks!


  1. User has not uploaded an avatar

    eyolf
    Member

    Thanks a lot for the tutorial, which I enjoyed quite a lot: not too much basic explanation, but just enough to give a newbie a fair chance to know what to look for and where. I like that.

    Anyway, it all seems to work fine, except for one thing: I get a message:

    Notice: Undefined index: count in /home/httpd/html/test/menu.php on line 41

    I fiddled around and solved it by adding

    $parent_menu[$obj->parent_id]['count'] = 0;

    at the start of the else { } segment where 'count' first appears. I don't know if this is the right way to do it -- my php knowledge is fairly shaky -- but I just thought I'd let you know, and if you have another solution, I'd be happy to hear about it.

    Posted 3 months ago #
  2. You can use it this way too:

    (quick and dirty)

    @$parent_menu[$obj->parent_id]['count']++;

    Posted 3 months ago #
  3. User has not uploaded an avatar

    eyolf
    Member

    Thanks.
    Another question: I want a two-level menu, and that's working fine. However, the directory structure goes three or four levels down, but when I visit files further down in the hierarchy, the submenu disappears. I would like all files in a directory under some of the main menu items to keep the current submenu open. So, e.g.:

    menuitem1     index.php
       subitem1   sub1.php
       subitem1   sub2.php
    menuitem2     dir1/index.php
       subitem1   dir1/subpage1.php

    where the page sub1.php may lead to a file dir2/page.php, which should keep the first submenu open. Is this possible?

    Posted 3 months ago #
  4. You need to add the QS var for the sub menu's to the URL

    Posted 3 months ago #
  5. User has not uploaded an avatar

    eyolf
    Member

    Excellent! Thanks a lot.

    Posted 3 months ago #
  6. try this function

    Posted 3 months ago #

RSS feed for this topic

Reply

You must log in to post.