Plugin

Developer
Supported

Entry Categories

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Laisvunas

     

You must be logged in to post.

Show all categories and entry was posted to

Support Request

brendann
brendann

Hi,
I was wondering how I would be able to show all categories an entry was posted to.

As obviously this plugin just uses direct variables to reference each category.

Thanks,
Brendan

Laisvunas
# 1
Developer
Laisvunas

Hi Brendann,

Using this add-on is possible to output all categories the entry was posted into.

You as a developer know how many levels the category tree has and you know how many categories there are in each level. So, knowing this you can you the code similar to the following:

{!-- To output all highest level categories --}
{if level0_category0_cat_name 
!= ""}{level0_category0_cat_name}{/if}<br>
{if level0_category1_cat_name != ""}{level0_category1_cat_name}{/if}<br>
{if level0_category2_cat_name != ""}{level0_category2_cat_name}{/if}<br>
{if level0_category3_cat_name != ""}{level0_category3_cat_name}{/if}<br>
{if level0_category4_cat_name != ""}{level0_category4_cat_name}{/if}<br>

{!-- To output all second level categories --}
{if level1_category0_cat_name 
!= ""}{level1_category0_cat_name}{/if}<br>
{if level1_category1_cat_name != ""}{level1_category1_cat_name}{/if}<br>
{if level1_category2_cat_name != ""}{level1_category2_cat_name}{/if}<br>
{if level1_category3_cat_name != ""}{level1_category3_cat_name}{/if}<br>
{if level1_category4_cat_name != ""}{level1_category4_cat_name}{/if}<br>


{!-- To output all third level categories --}
{if level2_category0_cat_name 
!= ""}{level2_category0_cat_name}{/if}<br>
{if level2_category1_cat_name != ""}{level2_category1_cat_name}{/if}<br>
{if level2_category2_cat_name != ""}{level2_category2_cat_name}{/if}<br>
{if level2_category3_cat_name != ""}{level2_category3_cat_name}{/if}<br>
{if level2_category4_cat_name != ""}{level2_category4_cat_name}{/if}<br
brendann
# 2
brendann

Hi,
Thanks for getting back to me. I basically wanted to stay away from something like that. As the number of categories within a level will grow all the time. I was hoping there might be a way to loop through the categories and output whichever ones were selected. But I guess it’s not really possible.

Thanks anyway

Laisvunas
# 3
Developer
Laisvunas

Hi Brendann,

That’s the point of the plugin - to output info about categories the entry was posted into without looping through tagdata.