I’ve discovered something a bit strange…I’m using a method from the wiki to display a list of categories and the post counts for each category. It works fine.
The only problem is when I want to check if one of the query results is equal to a certain value, so I can indicate the current category. When I try to do that all I get is a blank page.
Here’s the code:
<ul id="nav_categories" class="categories_list">
{exp:query sql="SELECT count(exp_category_posts.entry_id) AS post_count,
exp_category_posts.cat_id, exp_categories.cat_name AS cat_name
FROM exp_categories, exp_category_posts, exp_weblog_titles
WHERE exp_category_posts.cat_id = exp_categories.cat_id AND parent_id='0'
AND exp_weblog_titles.weblog_id = '2'
AND exp_weblog_titles.entry_id = exp_category_posts.entry_id
GROUP BY exp_categories.cat_name"}
<!-- this is the conditional bit where it falls over -->
<li><a href="http://{path=calendar/categories}C{cat_id}/" class="current">{cat_name} <span>({post_count})</span></a></li>
{/exp:query}
</ul>I’m trying to insert
{if {cat_name} == 'Education'} class="current"{/if}inside the a tag