Hi, I want to display a list of categories an entry is assigned to, and these categories should link back to their respective pages. Now those categories are attached to different templates so I need to display the template name dynamically for each category (hope it makes sense…)
I created this query:
{exp:query sql="SELECT template_name FROM exp_templates WHERE template_id = ‘{template_group}’”}{template_name}{/exp:query}
but unfortunately it still doesn’t display my template name.
To give you an idea, if I use this query:
{exp:query sql="SELECT group_name FROM exp_category_groups WHERE group_id = '{category_group}’”}{group_name}{/exp:query}
Then the group name shows correctly, but I don’t need the group name, I need the template name!
In case you want to see my code in action:
http://www.dev.ogaora.com/mcf/people/partner/david-byers
On the right below the thumbnail, the Practice Areas are the categories I want to link back to.
Any suggestions to point to the right direction?
Thanks in advance!
You could add a custom category field to hold the template name, then in your categories tag:
So to get the template name “corporate” create a custom category field called something like cat_template. Update your categories with the template name.
Then in your categories tag something like this:
{exp:channel:categories}
<a href="/mcf/people/partner/{cat_template}/{category_url_title}">{category_name}</a>
{/exp:channel:categories}
You could add a custom category field to hold the template name, then in your categories tag: So to get the template name “corporate” create a custom category field called something like cat_template. Update your categories with the template name. Then in your categories tag something like this:{exp:channel:categories} <a href="/mcf/people/partner/{cat_template}/{category_url_title}">{category_name}</a> {/exp:channel:categories}
That would be a great solution but it only works with one category group, I can’t use the same {cat_template} tag for all my Category Groups…
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.