GWcode HasChildren

http://gwcode.com/assets/img/add-ons/tn/gwcode-haschildren.gif

This light-weight plugin for ExpressionEngine 2.x allows you to check if a category has child categories and then use the result in a conditional. By doing so, you could for example show some content when a category has child categories and some other content when it doesn't.

In these examples, I'm going to assume segment_3 holds your category url title.
Change segment_3 to something else when needed.

First, make sure you call the plugin to check if a category has child categories.
You only have to do this once in the template, somewhere at the top for example. A closing tag is not necessary.

If you already have Low Seg2Cat installed, you can use this:

{exp:gwcode_haschildren:check cat_id="{segment_3_category_id}"}

Or, without Low Seg2Cat, you can use this:

{exp:gwcode_haschildren:check cat_url_title="{segment_3}"}

You can also add the group_id parameter if you want to limit the search for the cat_url_title in a certain category group
(different category groups can have categories with the same category url title):

{exp:gwcode_haschildren:check group_id="1" cat_url_title="{segment_3}"}

Then, you can use conditionals like this in your template:

{if gwcode_haschildren}
	<p>The currently viewed category has child categories! Show something.</p>
{if:else}
	<p>No child categories! Show something else.</p>
{/if}