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.

Most efficient way to group entry listings by category?

December 17, 2007 4:35pm

Subscribe [1]
  • #1 / Dec 17, 2007 4:35pm

    Brian M.

    529 posts

    So what I want to do is show, on one page, a listing of different entries and then group those into their respective categories.  This is for a library, so what I want to do is have:

    Fiction
    Book name, author, date entered, something else
    Book name, author, date entered, something else
    Book name, author, date entered, something else
    
    Non-Fiction
    Book name, author, date entered, something else
    Book name, author, date entered, something else
    Book name, author, date entered, something else
    
    Audio
    Name, author, date entered, something else
    Name, author, date entered, something else
    Name, author, date entered, something else

    And so on and so-forth.

    Now I can manually set that up using multiple weblog tags, but that’s terribly inefficient.  I could use the weblog:categories setting as well, but that doesn’t show custom weblog fields. Also - I need to have HTML at the beginning and end of each block of materials - so something like:

    <div class="category">
    <h2>Fiction</h2>
    <p><ul><br />
    <li>book and stuff here</li><br />
    </ul><br />
    </div>

    Is there a ‘best way’ to do that? I’m really trying to learn about optimizing for performance and calling the weblog tag once seems like a big win over doing it multiple times per page.

    Thanks for any help!

  • #2 / Dec 17, 2007 4:38pm

    Lisa Wess

    20502 posts

    Try this. =)

  • #3 / Dec 17, 2007 4:48pm

    Brian M.

    529 posts

    Hmm - well that’s excellent.  I didn’t realize that you could nest the weblog:entries tag into the weblog:categories tag.  Very cool!  That solves the problem of manually setting up the weblog entries tags on the template. That does still call the weblog entries tag multiple times though - I wonder if there’s another way that would result in one weblog:entries call?

    Thanks for the quick responses though!

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

ExpressionEngine News!

#eecms, #events, #releases