slapshotw - 25 August 2008 05:48 PM
Exp:categories has a show= parameter:
http://expressionengine.com/docs/modules/weblog/categories.html#par_show
The show parameter will limit the categories tag to only certain categories, and then the weblog:entries tag will be dynamic based off that. You only need one of each tag to keep iterating.
Or did i misunderstand your goal?
Ah, I missed the “show” parameter. Ok, here’s the code I’ve got now:
{exp:weblog:categories weblog="stuff" show="4"}
<strong>{category_name}</strong>
{exp:weblog:entries weblog="stuff" disable="comments|trackbacks|member_data" category="4"}
<p>{stuff_image}<strong>{name}</strong><br />
{stuff_detail}</p>
{/exp:weblog:entries}
{/exp:weblog:categories}
{exp:weblog:categories weblog="stuff" show="5"}
<strong>{category_name}</strong>
{exp:weblog:entries weblog="stuff" disable="comments|trackbacks|member_data" category="5"}
<p>{stuff_image}<strong>{name}</strong><br />
{stuff_detail}</p>
{/exp:weblog:entries}
{/exp:weblog:categories}
etc...
Is this what you were suggesting? I’m not sure if I’ve missed something else, or what, but only the first “statement” is pulling any data back, unfortunately, and only 1 of 2 entries in the first category. Right now I’ve got 3 entries in the weblog, entry 1 and 3 are labeled as category #1, and entry 2 is in category #2. The literal IDs for the category in this case per the control panel (Category Groups->Category Management) are 4 and 5, so I would think that the code in my example above would show the category name for category ID #4 and its two entries, then the category name for category ID #5 and it’s single entry. Unfortunately, that’s not what I’m seeing. I’d offer to let you take a look at the site, but it’s on a test server behind a firewall at work.
Edit: Btw, I’ve tried the above code with and without the “category=” parameter in the exp:weblog:entries tag. If I don’t include it, all weblog entries show, regardless of the category, if I do include it, only the first entry shows. =/ Am I missing something obvious? Are you allowed to next the exp:weblog:entries tag in the exp:weblog:categories tag?
Edit 2: Gah, I’m an idiot. The category wasn’t being set on one of the entries, hence why only 1 entry showed up for the first category. Phew. Ok, that answers that question.
I think this method will work for me, but if there is a better way to handle the code so it’s a bit more automatic (for example, if I add a new category for this weblog, I will need to add a section of code in the template that specifies the category ID for the new category…), I’d love to know. Thanks for all of your help!