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.

Nested Weblog Entries inside of Categories

June 25, 2007 1:28pm

Subscribe [3]
  • #1 / Jun 25, 2007 1:28pm

    bjsteiger

    87 posts

    Previous to 1.6 I used to nest a exp:weblog:entries tag inside of exp:weblog:categories but it doesn’t appear to work any more:

    Old Code:

    {exp:weblog:categories weblog="{my_weblog}" category_group="3" show_empty="no" limit="1" style="linear"}
    <h3>{category_name}</h3>
    
    <p><ul><br />
    {exp:weblog:entries weblog="{my_weblog}" orderby="title" category="{category_id}"}<br />
    <li>{title}</li><br />
    {/exp:weblog:entries}<br />
    </ul></p>
    
    <p>{/exp:weblog:categories}

    How can I produce the same type of output now:

    Category Title #1
    - Weblog Entry #1
    - Weblog Entry #2
    - Weblog Entry #3
    Category Title #2
    - Weblog Entry #1
    - Weblog Entry #2
    Category Title #3
    - Weblog Entry #1
    - Weblog Entry #2
    - Weblog Entry #3

    Basically the idea is I want to show articles that below to a category, just sorting the content based upon the category (another way to write it). Then each Weblog Entry is linked to the full weblog entry content.

    If this requires a query I’m not sure what I should do to start?

    Thank you

  • #2 / Jun 25, 2007 1:37pm

    bjsteiger

    87 posts

    FYI—I got the principle from this WIKI post:

    http://expressionengine.com/wiki/Category_Archives_with_Custom_Fields/

    I’ve also tried with the same specific tags Les suggested without any luck as well.

    bjs

  • #3 / Jun 25, 2007 2:47pm

    Lisa Wess

    20502 posts

    Why are you nesting if you just need the titles?  You can just use the category archives tag.

    Also, do make sure that you are on the latest build of 1.6.  There was a bug-fix build released on the 22nd.

  • #4 / Jun 25, 2007 3:00pm

    bjsteiger

    87 posts

    Hello Lisa…

    Well, I was keeping it simple, but I also want the summary from the entries as well. On a different point, I tried what you suggested, but I want it with bullets ONLY on the titles:

    {exp:weblog:category_archive weblog="{my_weblog}" style="linear"}
    {categories}
    <h3>{category_name}</h3>
    <p>{/categories}</p>
    
    <p><ul><br />
    {entry_titles}<br />
    <li><a href="http://{path=resources/index}">{title}</a></li><br />
    {/entry_titles}<br />
    </ul></p>
    
    <p>{/exp:weblog:category_archive}

    The problem is that the <li> tags work but the <ul> tags are no where to be found in my code. I’m also updated with today’s code.

  • #5 / Jun 25, 2007 3:20pm

    Lisa Wess

    20502 posts

    Try this:

    <ul>
    {exp:weblog:category_archive weblog="{my_weblog}" style="linear"}
    {categories}
    <h3>{category_name}</h3>
    <p>{/categories}</p>
    
    <p><br />
    {entry_titles}<br />
    <li><a href="http://{path=resources/index}">{title}</a></li><br />
    {/entry_titles}</p>
    
    <p>{/exp:weblog:category_archive}<br />
    </ul>

    You’ll need the category name in the LI as well to validate, but you can style it so it doesn’t effect your layout.

    Do you mean you updated to the latest build today? Have you created any categories since updating to 1.6 at all?

  • #6 / Jun 25, 2007 3:23pm

    bjsteiger

    87 posts

    But isn’t this bad XHTML code?

    I updated all of my code today to the latest build - all of the categories have been created today since this new build.

    bjs

  • #7 / Jun 25, 2007 3:27pm

    Lisa Wess

    20502 posts

    If you add the li around the the category name h3s then it will validate strict, I believe. You can always run it through the validator.  Lets make sure this method works - the categories did undergo a major change and that nesting was never really supported, so lets see if the supported code works then go from there. =)

  • #8 / Jun 25, 2007 3:35pm

    bjsteiger

    87 posts

    This worked—for now to get functionality working, I won’t worry about validating.

    So how do I add the summary to this:

    <ul>
    {exp:weblog:category_archive weblog="{my_weblog}" style="linear"}
    {categories}
    <h3>{category_name}</h3>
    <p>{/categories}</p>
    
    <p>{entry_titles}<br />
    <li><a href="http://{path=resources/index}">{title}</a><br>{summary}</li><br />
    {/entry_titles}</p>
    
    <p>{/exp:weblog:category_archive}<br />
    </ul>

    Notice the {summary} tag inside of the <li> element.

  • #9 / Jun 25, 2007 4:13pm

    Lisa Wess

    20502 posts

    Oh, you know what I bet it is?  1.6 added category custom fields, and some of the tags are evaluating weblog custom fields as category custom fields.  I am not sure if this method will continue to work with the nesting and possible conflicts.  I’ll have to look into and I’ll get back to you.

  • #10 / Jun 25, 2007 4:31pm

    Lisa Wess

    20502 posts

    Ok, I have looked into this.  The next build will fix up the issue with the custom fields and this method should work again once that build is up.  As a note, that method is still discouraged as nesting, especially involving the weblog entries tag, can be very, very intensive.

  • #11 / Jun 25, 2007 4:34pm

    bjsteiger

    87 posts

    Very cool—do you know when that new build will be up?

    bjs

  • #12 / Jun 25, 2007 4:36pm

    Lisa Wess

    20502 posts

    I am not sure at this point, sorry.  You can subscribe to the RSS for the builds forum if you want notification, though!

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

ExpressionEngine News!

#eecms, #events, #releases