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
create a sub category inside a sub category in a menu
  • Hello again :)
    i'm having trouble creating a sub category for a sub category in thr menu as such :
    -----------------------------------------------------------------
    parent menu
    V
    sub category
    V
    sub category -> SUB SUB CATEGORY
    V
    sub category
    -----------------------------------------------------------------
    (Hope this is clear LOL)
    I have set the categories right on feindura CMS and it doesnt work.
    i'm using your default creatMenu and creat submenu code :
     
    foreach($feindura->createMenu('category',0,'ul.menu') as $item) {
    echo $item['startTag'];
    echo $item['link'];
     
    foreach ($feindura->createSubMenuOfPage($item['pageId'],'ul.menu') as $subItem) {
    echo $subItem['menuItem'];
    }
    echo $item['endTag'];
    }


    Any Suggestions Master ? :)
  • to create a sub sub category, your first sub categry needs to have "edit sub categories" activated in the page settings. then you just select in the first subcategory a page and set another sub category.

    to show this in the frontend you need to have a third foreach iteration inside the second one. And you also have to add the right stylesheets to make the third <ul> visible on hover or whatever.
    foreach($feindura->createMenu('category',0,'ul.menu') as $item) {
    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.subsubmenu') as $subItem) {
    echo $subItem['menuItem'];
    }
     
    echo $subItem['endTag'];
    }
     
    echo $item['endTag'];
    }

    I didn't test this, but this would be the way i would approach it. :)
  • thanks.
    the "edit sub categories" is on and all the categories are well connected.
    tested this code and it doesnt work :( . every thing is scrumbled.
    what else can i do?
  • this code should work, what you have to do is to code the css for it.

    if you look in the source code you should see 3 ul's in each other. then you have to style them and hide or show them , when you hover over one of the links.

    see how i do this in the css of the demo site. try also to change the ul.submenu into ul.menu to get at least then basic menu styling.

    feindura doesnt take away the need to design and style the sites yourself, it just delivers the content :)
  • ok thanks.
    will try.
  • is it posible that something in the code you gave me is not accurate?
    when i place it the whole menu disappears and shows all over the place.
  • hm...

    ah there is a error is guess:
    foreach($feindura->createMenu('category',0,'ul.menu') as $item) {
    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'];
    }

    try if this works better. but the best way to find out if something is wrong, look in the sourcecode of the menu and see whats generated...

    you can post it here.
    you can add code blocks by using:

    <pre lang="php">...</pre>
  • U ARE THE MAN !!! it works great !!
    I need to find out of a way to reward you.
    thanks a million :)
  • there is a simple donation button on the download page :) this would help.
  • consider it DONE . you deserve it :)
  • ok, i was happy a bit to soon, there is one problem :
    when clicking on an item that has no category the menu looks fine, but when clicking on a parent menu item that has a category, all parent menu items get all the categories and it looks like a mess.
    this is the html generated when clicking on the seconed menu item that normaly should have only 2 sub categories.
    dont mind the hebrew text, you can see the pages id to see the duplicate.
    <ul class="menu sf-js-enabled sf-shadow">
    <ul class="menu sf-js-enabled sf-shadow">
    <ul class="menu sf-js-enabled sf-shadow" style="display: none; visibility: hidden;">
    <li><a href="/adiamar.co.il/?category=1&amp;page=3&amp;parentPages=2" title="בין לקוחותינו">בין לקוחותינו</a></li>
    <li><a href="/adiamar.co.il/?category=1&amp;page=5&amp;parentPages=2" title="המלצות">המלצות</a></li>
    </ul>
     
    <li><a href="/adiamar.co.il/?category=1&amp;page=3&amp;parentPages=2" title="בין לקוחותינו">בין לקוחותינו</a></li>
    <li><a href="/adiamar.co.il/?category=1&amp;page=5&amp;parentPages=2" title="המלצות">המלצות</a></li>
     
    <ul class="menu sf-js-enabled sf-shadow" style="display: none; visibility: hidden;">
    <li><a href="/adiamar.co.il/?category=1&amp;page=3&amp;parentPages=2" title="בין לקוחותינו">בין לקוחותינו</a></li>
    <li><a href="/adiamar.co.il/?category=1&amp;page=5&amp;parentPages=2" title="המלצות">המלצות</a></li>
    </ul>
     
    </ul>
    .
    .
    .


    any ideas?
  • iam a little bit confused here.

    normally it should look like this:
    // there is an ul
    <ul>
    // then comes an li
    <li>
    <a href="...">Parent Page Title</a>
     
    // the comes the sub category
    <ul>
    <li>..</li>
    <li>..</li>
    ..
    </ul>
    </li>
    <li>
    ...
    </li>
    ...
    </ul>


    i dont understand why there are, in your case, 2 different ul's in each other and then the other ones outside the <li>?

    the echo $item['startTag']; and echo $item['endTag']; will create the <ul> and the on the beginning and when there is a page they contain the <li> and </li>.

    somehow it doesn't seem wrapped right around the sub category foreach's..

    this is my only guess.
  • by the way.

    an design advice.
    its better you maximal use one sub-level, two is to much.

    if you need to, better put the content on one long page, because scrolling is easier as clicking.

    just thoughts..
  • thanx. for most parts i agree, but for this client its the best solution. (there are more than 50 pages on the site)
    i dont know why it's wrapped that way. this is what happend after i placed the last version of the code you wrote for me :
    foreach($feindura->createMenu('category',0,'ul.menu') as $item) {
    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'];
    }

    by the way, this only happens when you click on a parent menu item that has sub category. if you click on one of the category's items or on a menu item with out sub category, the menu and all sub categories look right.
    weird.. i know
  • hm...

    i never tested this double nested sub categories, but i assumed it will work.

    could you post the html code which is generated, when you click on a sub category item and on a parent item?