Hello…
I’m developing a category-based navigation system (it’s done for the most part). I’m needing a conditional that will check to see if a main category has subcategories. If it doesn’t, then it will display a message to the user.
I developed a script that works fine theoretically, but for whatever reason, I can’t use {no_results} because its overridden by the categories tag (instead of working correctly in regards to the exp:query tag).
I’m not familiar at all with SQL JOIN statements, nor am I sure that’s even the route that I should go, but I’ve seen people accomplish similar using them. Is there a way to join the functionality achieved using the two EE tags below and create a single query that accomplishes what I need it to?
{exp:channel:categories channel="resources" style="linear"}
{if category_url_title == segment_2}
{exp:query sql="SELECT cat_id FROM exp_categories WHERE parent_id = '{category_id}’ LIMIT 1”}
{if no_results}
No subcategories exist for this section.
{/if}
{/exp:query}
{/if}
{/exp:channel:categories}
Thanks!