0

EDIT!!!

It's not about categories, it's about addresses and templates.

I need to get 2 types of pages:

site.com/sport/football/ — page with lots of entry site.com/sport/football/realmadrid — page with one entry

Sport - group, Football - template, Realmadrid - it's entry ({url_title})

The blog entry site.com/sport/football/realmadrid is built on the basis of the template Football. And it works well, the right address is obtained. But i need to have site.com/sport/football/ give a completely different template, in which there will be a list of all the records and with a different design. But it is already occupied by entry template.

1

take a look at Low's Seg2Cat. It's a free plugin that will allow you to use category names in the url to easily display the category contents on a page instead of messing with cat ids.

Using Seg2Cat will allow you to specify the category to use in your template tags without messing with cat_id in the URL.

For example, you have a template group called products and you want to have a category display page. Lets use shirts as an example so you would have a template in the products group called shirts.

Your URL would be domain/products/shirts

To display a specific category on the shirts page you could set your channel entries tag to detect the 3rd segment as a category.

{exp:channel:entries channel="yourchannel" category="{segment_3_category_id}"}

This would allow you to use the 3rd segment to define the id. The brilliant thing is that you can just use your category_url and seg2cat will work out the correct id to use. Following the example above, your url could be domain/products/shirts/mens_dress_shirts or domain/products/shirts/ladies_knit_shirts or whatever else. As long as the segment pattern has a valid category_url, you should be fine and you can then use a single template to display multiple categories.

There are other tags available to display your category name, parent cat, etc. Check out the plugins documentation for more examples.

| improve this answer | |
  • Hello! And which template will refer URL with category? – Erick Flatcher May 16 '17 at 20:33
  • I have added further information above that may help. – pixldev May 17 '17 at 0:33
  • I'm a little wrong. It's not about categories. I need to get 2 pages: site.com/sport/football/ — page with lots of entry site.com/sport/football/realmadrid — page with one entry Sport - group, Football - template, Realmadrid - it's entry ({url_title}) The blog entry realmadrid is built on the basis of the template Football. And it works well, the right address is obtained. But i need to have site.com/sport/football/ give a completely different template, in which there will be a list of all the records and with a different design. But it is already occupied by entry template. – Erick Flatcher May 17 '17 at 13:34
  • if I'm understanding you correctly, it sounds like you'll need to place a conditional on the football template so that when segment_3 (realmadrid) is present, you get a single entry view and when the segment is not present you get the category view. – pixldev May 19 '17 at 0:26
  • ok, thx, i will try. ;) And… maybe is it better to use a Pages module? – Erick Flatcher May 19 '17 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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