Reputation: 38
I am building a site with EE and was wondering what peoples thoughts are on the situation I have.
Basically I have 3 different channels with similar data that when viewed need to be shown on the same template. So I have a channel for news, artists, and products. When I click on an item in any one of those channels I need to show that data in the same template regardless.
There are 2 ways I can think of to do this but was wondering if anyone had a more elegant solution.
Thanks
Upvotes: 0
Views: 238
Reputation: 538
You can pass variables into your embeds with embed variables.
One other thing to note, use Switchee and/or IfElse from Mark Croxton when determining what content to load. Advanced conditionals are terrible for performance.
Upvotes: 1
Reputation: 1085
{exp:channel:entries channel="news|artists|products"}
...shared content...
{if channel_short_name == "news"}
{my_custom_field_for_news}
{if:elseif channel_short_name == "artists"}
{my_custom_field_for_artists}
{if:elseif channel_short_name == "products"}
{my_custom_field_for_products}
{/if}
...shared content...
{/exp:channel:entries}
Upvotes: 0
Reputation: 15476
Typically you would either embed templates or use snippets to overcome this.
For my solutions I have a template group named global_embeds which serves as a container for template views I'd like to reuse. This could be the head part and footer part of my general page layout.
Then a snippet for some of the more trivial stuff (like item displaying).
Upvotes: 0