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.

Display entries within a category

May 27, 2010 11:28am

Subscribe [2]
  • #1 / May 27, 2010 11:28am

    bmdstinky

    4 posts

    Hi All,

    I’m sure this is super easy but I’m really struggling! I have a 4 categories that are displaying fine for my ‘food_offers’ weblog.

    {exp:weblog:categories weblog="food-offers" style="linear"}
    
    <h3><a href="http://{path=food/offers/{category_url_title}}">{category_name}</a></h3>
    
    <p><br />
    {/exp:weblog:categories}

    Easy. The problem I’m having is on my offers/category page. I can’t get it to display the weblog entries within that category. Here’s what I have so far but it’s only displaying {offer-title} 4 times (I have 4 entries but only 1 in each category)

    {exp:weblog:categories weblog="food-offers" style="linear" category="{category_id"}
    
    <h3>{offer-title}</h3>
    
    <p><br />
    {/exp:weblog:categories}

    Any ideas on how to get this to work?

    Thanks in advance,
    Brett

  • #2 / May 27, 2010 12:26pm

    Ian Ebden

    312 posts

    Hi Brett. First you need to change your link from

    <h3><a href="http://{path=food/offers/{category_url_title}}">{category_name}</a></h3>

    to

    <h3><a href="http://{path=food/offers}">{category_name}</a></h3>

    EE will take care of adding the category to the url. Next, you need to use the weblog:entries tag on your category page, not the weblog:categories tag; and make sure you use the parameter dynamic=“on”. That should do it.

  • #3 / May 27, 2010 2:00pm

    bmdstinky

    4 posts

    Ian,

    Thanks for the reply. I’ve made those changes but I get all entries for that weblog on every category page. I’ve double checked the entries have different categories set and they do.

    Here’s my updated offers template

    {exp:weblog:entries weblog="food-offers" dynamic="on"}
    
    <h3>{offer-title}</h3>
    
    <p>{/exp:weblog:entries}

    The dynamic flag should pull in only entries related to that category right?

    Thanks,
    Brett

  • #4 / May 27, 2010 2:02pm

    Lisa Wess

    20502 posts

    Hi bmdstinky, have you seen The Importance of Semantics: Displaying Categories?  That should help you clear this up.

    Also moving down to technical support.  You only need dynamic= if you’re turning it off, on/yes (1.6.9/2.0 respectively) is the default state.

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

ExpressionEngine News!

#eecms, #events, #releases