ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to display category id

April 20, 2012 2:36am

Subscribe [1]
  • #1 / Apr 20, 2012 2:36am

    Suraj Timalsina

    32 posts

    Hi,
    I am trying to display category ID next to category name. Following code is not outputting the Category ID. Channel news has been assigned to News Category Group with it having two parent categories: Local and International, and also each paranet category contains three sub categories. I’ve created few channel entries for new channel and assigned categories for each entry as well. On below code, it pulls cagegory_name values correctly but no category_id associated to the category_name. What could have gone wrong here!

    {exp:channel:categories channel="news" show_empty="yes" style="none"}
    {category_name} - {category_id} 
    
    {/exp:channel:categories}
    Output:
    Local -
    International - 
    Sports -
    Entertainment -
    Media -
    Blog -
    Spotlight -

    EE version 2.4.0
    No Caching

     

  • #2 / Apr 20, 2012 2:50am

    Suraj Timalsina

    32 posts

    I figured it out. I had a snippet named category_id that created all kinds of problems. Good thing I nailed it down early enough. 😊 It would be a good idea to have ee maintain reserved keywords and check snippet name against them. 😊

  • #3 / Apr 20, 2012 5:36pm

    Shane Eckert

    7174 posts

    Hello Bishnu Timalsina,

    I am glad to see you have this figured out! Nice.

    If you need anything else, please just let us know by opening a new thread.

    Have a great weekend!

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases