Category specific conditionals inside category template
Is the following possible with Seg2Cat?
1. For my blog category template I want to display some additional html but just for specific categories. So I'm thinking inside my blog category template I should have a conditional that checks if your inside let's say category "a" and then display specific html if it's true, but if it's category "b" then display some other html, if it's category "c" then display some other html etc. Is so many concurrent conditionals possible?
2. On that same blog category template if it's let's say category "a", is it possible to pull in entires from another channel with the same category name (obviously a different category id) e.g. If category "a" check another channel and see if category "a" exist there too, if so display the entries from that channel, but only for that specific category.
Thanks!
Replies
Low 3 Jan 2013 08:19
Low Seg2Cat only sets some global variables based on the presence of category_url_titles in the URI. That's all it does. What you then do with those variables is up to you.
That means if you want to make your first point work, you'd have to hardcode the conditionals in your template:
...etc. Note the use of simple conditionals here. Or you could use Switchee.
As for point 2, Low Seg2Cat doesn't provide you with related categories. Just the ones that are in the URI.
info 3 Jan 2013 11:04
Thanks Low. Ok I got you on point one. To give you a better overview.
I only have 6 categories in my blog. Those categories have subcategories. For each category I’m displaying different images and background image and also pulling in entries from two additional channels if categories match in those other 2 channels.
Can you recommend the best way to do this in terms of clean/performace or do you think I should hardcode my category templates, or is there another way you can recommend I achieve this with another plugin perhaps?
Thanks!
Low 3 Jan 2013 11:10
Low Seg2Cat doesn't differentiate between parent categories and subcategories. They're all just categories as far as the add-on is concerned.
And as this is venturing away from my add-on and more into general how-to area, I suggest you broaden your quest and ask your question over at the ExpressionEngine StackExchange site to get more exposure.
info 4 Jan 2013 14:58
Thanks