ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Generate Menu Based on Categories

June 12, 2008 4:47pm

Subscribe [2]
  • #1 / Jun 12, 2008 4:47pm

    nyeoman

    94 posts

    I’m trying to create a menu based on my categories.

    I would imagine creating a menu based upon categories is a common task. So I must be going about this the wrong way.

    The issue I’m having is I cannot access the <li> to place an id in the selected item.  If I use the style=“linear” my sub-categories are not nested.

    Here is my code which is located in an embed.  The if statement I’m using works, it is just located in the <a> rather than the <li>

    {exp:weblog:categories weblog="kb" show_empty="no" category="18"}{!-- cat 18 is kb --}
    <a href="#id=selected"> _{category_name}_</a>
    {/exp:weblog:categories}

    Is anybody aware of any plugins or tricks to solve this?

  • #2 / Jun 12, 2008 6:04pm

    rokker

    179 posts

    I’m trying to create a menu based on my categories.

    I would imagine creating a menu based upon categories is a common task. So I must be going about this the wrong way.

    The issue I’m having is I cannot access the <li> to place an id in the selected item.  If I use the style=“linear” my sub-categories are not nested.

    Here is my code which is located in an embed.  The if statement I’m using works, it is just located in the <a> rather than the <li>

    {exp:weblog:categories weblog="kb" show_empty="no" category="18"}{!-- cat 18 is kb --}
    <a href="#id=selected"> _{category_name}_</a>
    {/exp:weblog:categories}

     

    Is anybody aware of any plugins or tricks to solve this?

    i realized i didn’t have a good answer… 😉

  • #3 / Jun 12, 2008 6:08pm

    nyeoman

    94 posts

    The issue I’m having is I cannot access the <li> to place an id in the selected item.  If I use the style=“linear” my sub-categories are not nested.

    so current output is:

    <ul>
    <li><a href="#">foobar</a></li>
    <li><a href="#">foobar2</a></li>
    <li><ul><li><a href="#">foobar3</a></li></ul>
    </li>
    </ul>

    and I want:

    <ul>
    <li id="selected"><a href="#">foobar</a></li>
    <li><a href="#">foobar2</a></li>
    <li><ul><li><a href="#">foobar3</a></li></ul>
    </li>
    </ul>

    (I clarified anyway, maybe someone else will)

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases