Category based HTML output
Is there a way to switch output for different categories. For instance (simplified code..):
{exp:low_search:results query="{segment_3}" limit="15"}
{if category_id == "1"}
< a href="...">{title}< /a>
{if:else}
{title}
{categories}{category_name}{/categories}
{/if}
{if no_results}No search results{/if}{/exp:low_search:results}
I know it doesn't make sense to not have a link in a search result, but it is the concept of displaying different HTML output based on a category ID.
I cannot wrap the entire thing inside the {categories} tag pair because I am using that inside the loop as well.
Thanks!
Replies
Low 29 Oct 2013 22:17
You'd have to approach it in the same way you would with the channel:entries tag. So something like
...but that will only work if the entry has just one category assigned.
conradical 30 Oct 2013 02:16
Of course! That does the trick. Thanks!