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.

format nested categories in dropdown

October 18, 2008 6:55pm

Subscribe [2]
  • #1 / Oct 18, 2008 6:55pm

    Tammo

    59 posts

    Hi,

    Hopefully someone can help me out with the following:

    I want to use a category list with sub categories on the side bar for navigation. The sub category should have an indent. I get this to work with the following code:

    {exp:weblog:categories weblog="jobs" style="nested" status="open"}
    <a href="http://{path=jobs}">{category_name}</a>
    {/exp:weblog:categories}

    But I also want a drop down list for the categories and therefore use the following code:

    <form name="catmenu" action="">
    <select name="selcat">
    <option value="">--Select Category--</option>
    {exp:weblog:categories weblog="jobs" style="nested" status=>"open"}
    <option value="{path=jobs}">{category_name}</option>
    {/exp:weblog:categories}
    </select>
    </form>

    Unfortunatly it shows just a straight list with head and sub categories. I think it has to do with the css tags but tried to apply it without any luck.

    Any help in this would be great.

    Regard,
    Tammo

  • #2 / Oct 18, 2008 7:33pm

    silenz

    1651 posts

    Maybe this is what you are looking for.

  • #3 / Oct 18, 2008 8:13pm

    Tammo

    59 posts

    Hi Silenz,

    Thanks for your reply, I tried the plugin and it seems to be able to do what I want. I had to adapt the example and I think I am nearly there. One thing I need to solve is that whenever I click on any of the categories the drop down selection will jump back to the first top category instead of showing the page with the category entries.

    My code is:

    <div class="block news">
    <h2>Job Categories</h2>
    <p><div class="content"><br />
    <form name="catmenu" action=""><br />
    <select name="selcat"><br />
    {exp:textnest fill="  "}<br />
    {exp:weblog:categories weblog="jobs" category_group="4" style="nested"}<br />
    <option value="{path=jobs}">{exp:xml_encode}{category_name}{/exp:xml_encode}</option><br />
    {/exp:weblog:categories}<br />
    {/exp:textnest}<br />
    </select><br />
    </form> <br />
    </div><br />
    </div>

    Hope you can help to solve the last bit.

    Cheers,
    Tammo

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

ExpressionEngine News!

#eecms, #events, #releases