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.

List by category

April 18, 2009 1:22pm

Subscribe [2]
  • #1 / Apr 18, 2009 1:22pm

    Bob K

    144 posts

    I’m working on templates for a client but I’m running into some troubles displaying information by category and I can’t quite figure it out. I am using this code:

    {exp:weblog:categories}
    <h2>Category: {category_name}</h2>
    <p>{/exp:weblog:categories}</p>
    
    <p>{exp:weblog:entries weblog="my_weblog" limit="10" status="open" paginate="both" rdf="off"} </p>
    
    <p>{paginate}<br />
    Page {current_page} of {total_pages} pages {pagination_links}<br />
    {/paginate}<br />
          <br />
    {title}<br />
            <br />
    {/exp:weblog:entries}

    to produce a page that should display each title in a given category. Instead, all titles in all categories for that weblog are displayed. So, if I open a url such as /my_categories/category_1, I get a list of all titles in category_1, category_2, category_3, etc. instead of just category_1.

    The code shown above works slick in other websites I have created but not this one and I am unsure of where to look to get this site corrected. Any help is always appreciated.

  • #2 / Apr 18, 2009 2:51pm

    Greg Aker

    6022 posts

    Bob:

    I think the Category Archive tag would fit the ticket for you here.

    -greg

  • #3 / Apr 18, 2009 3:44pm

    Bob K

    144 posts

    Thanks, Greg, that’s not a bad tag but the client has a side navigation where he lists out the categories and wants a link to each. It’s for a store so he needs to list all the products available under each specific category. I was wanting to treat the template kind of like an archive of entries by category.

  • #4 / Apr 18, 2009 3:58pm

    Greg Aker

    6022 posts

    Bob:

    How does the tag not work for you?  It lists out each category with the entries in the category under the cat name.

    -greg

  • #5 / Apr 18, 2009 5:12pm

    Bob K

    144 posts

    All the entries from all the categories are listed on a single page, like a sitemap. I need them to be separated so that each category appears to have its own page, so that the 12 products sold in category_1 are shown on a “page” titled category_1, the 7 in category_2 on a “page” called category_2 and so on.

  • #6 / Apr 19, 2009 5:39pm

    Greg Aker

    6022 posts

    You should be able to do this with a regular weblog entries loop.  What does the whole URL you are trying to point to look like?

    -greg

  • #7 / Apr 20, 2009 10:54am

    Bob K

    144 posts

    I tried a weblog entries loop and get the same output: all products in all categories are listed instead of being separated by category.

  • #8 / Apr 20, 2009 11:15am

    Bob K

    144 posts

    Got this one solved. The client had url links to the categories with category names attached but an incorrect reserved name (matched a template). All the code could do was list out every entry in the weblog.

    Thanks for the help, though, Greg.

  • #9 / Apr 20, 2009 11:26am

    Sue Crocker

    26054 posts

    Glad Greg was able to help. Don’t hesitate to post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases