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.

category nested styles problem

April 27, 2011 11:04am

Subscribe [5]
  • #1 / Apr 27, 2011 11:04am

    fin

    168 posts

    Running v2.1.3 - Build:  20110411. I’m using nested styles for a list of links in a category tag, like so:

    {exp:channel:categories channel="book-reading" style="nested" class="category-nav" show="19|20|21"}
                        <a href="http://{path=book-readings/type}">{category_name}</a>    
                {/exp:channel:categories}

    My category name is type. Even though I’ve defined a class, the default id “nav_categories” shows up inside the <ul> when I view source?

  • #2 / Apr 27, 2011 2:41pm

    Leon Dijk

    131 posts

    Hi fin,

    You defined the class for the ul tag and you say the default id for the ul is still “nav_categories”. That’s normal behaviour as you can read here: http://ellislab.com/expressionengine/user-guide/modules/channel/categories.html#par_id

    By default, if you don’t use the id parameter, it will have an id “nav_categories”. So if you want that to change, you’ll have to use the id parameter in your exp:channel:categories tag.

    Or did you mean you provided a custom css class and it still uses the default “nav_categories” class?

  • #3 / Apr 27, 2011 3:10pm

    fin

    168 posts

    Yeah Leon, I have a class defined in the css.

  • #4 / Apr 27, 2011 3:15pm

    Leon Dijk

    131 posts

    Hi fin,

    Sorry, you may have misunderstood what I meant. Could you show me what the output is like?

    If it shows this:

    <ul id="nav_categories" class="category-hav">
        <li><a href="http://something">your category name</a></li>
    </ul>

    ..then that’s what it should do. If you want to change the id, then you’ll have to use the id parameter.

    Cheers,
    Leon

  • #5 / Apr 27, 2011 3:50pm

    fin

    168 posts

    Yeah Leon, it is outputting the default id; however,  shouldn’t the class tag remove the default id, or does it just output that id regardless? As you said, I guess I’ll have to define my own id to override the default. Thanks.

  • #6 / Apr 27, 2011 4:02pm

    Leon Dijk

    131 posts

    Hi fin,

    No, the class parameter doesn’t affect the id parameter so it will output the id regardless.

    Both are added by default and you can override both of them by using the class and id parameters. Seems like you can’t remove them though as I’ve tried using

    class="" id=""

    but they are both still being added.

    Not a big problem though right? Just leave the id as it is, or change the value with the id parameter. Would still be nice though to have the option 😊

  • #7 / Apr 27, 2011 4:35pm

    fin

    168 posts

    Not really sure why this is happening, but one of these category-navs is outputting extra markup on one page, and breaks the styles. I’ve used it in another page and it works fine. Both have different channels.

  • #8 / Apr 28, 2011 4:52am

    John Henry Donovan

    12339 posts

    fin,

    Have you got a link to the page in question?
    If not can you show us how it is breaking your styles?
    What extra markup is it adding?
    Is it the same template code as above?

  • #9 / Apr 28, 2011 8:16am

    fin

    168 posts

    Hey John, thanks. To remove the default id, the template now looks like this:

    {exp:channel:categories channel="book-reading" id="category-nav" class="category-nav"  show="19|20|21"}    
                        <li><a href="http://{path=book-reading/}">{category_name}</a></li>
                {/exp:channel:categories}

    This is the page itself. You can see the category nav at the bottom of the content. When you view source, you’ll see the extraneous markup.

  • #10 / Apr 28, 2011 8:16am

    fin

    168 posts

    this reply could couldn’t be deleted.

  • #11 / Apr 29, 2011 4:47pm

    Brandon Jones

    5500 posts

    fin,

    Are any of those categories empty? Give us an idea of that category structure for those IDs so we can try to replicate. Thanks!

  • #12 / May 01, 2011 9:21am

    fin

    168 posts

    My mistake.  I’ve fixed it. Thanks.

  • #13 / May 01, 2011 4:33pm

    Greg Salt

    3988 posts

    Hi fin,

    Excellent. Thanks for the update and glad that you got this sorted. Please post back if you have further questions or problems.

    Cheers

    Greg

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

ExpressionEngine News!

#eecms, #events, #releases