1

In the URL www.site/recipes/meat, the segment 2 is a category, so, to make this work, I use a template with the category´s name:

the category template, is named (meat):

{embed="recipes/.recipes" url_title="meat"} 

The main template, is named (.recipes):

{embed="estrutura/.template"}
     {exp:stash:set name='main'}
       .........
     {/exp:stash:set}  

So, when the category appears in the url, the main template .recipes is called by the category template. With, www.site/recipes/meat, all the entries of this category are listed.

It's working fine, but I have to create a small category template for each category. I'm curious to know if a more efficient templating way exists?

Stéphane

1 Answer 1

4

By default EE looks for the category indicator in the URL, eg www.site/recipes/category/meat, then output content based on that category url title (/meat).

If you don't want to use the category indicator you'll need to use the LowSeg2Cat addon http://gotolow.com/addons/low-seg2cat - you can then use one entries tag and one template for any category, simply by using Seg2Cat to pull in the category ID:

{exp:channel:entries channel="mychannel" category="{segment_2_category_id}"}
{title}
{/exp:channel:entries}
1
  • Bluedreamer, thanks for your tip! I didn't think about LowSeg2Cat.
    – Stéphane
    Feb 9, 2014 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.