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.

Getting the category ID of the last segment

July 10, 2012 3:24pm

Subscribe [1]
  • #1 / Jul 10, 2012 3:24pm

    AirWatch

    26 posts

    Hey - I want to display the Category Description on the page. The Category URL happens to be the last segment in the URL. So using

    {ext:channel:categories show="{last_segment_category_id}"}
         {category_description}
    {/exp:categories}

    This works if the Category is a parent category. However if the last segment is a child category, it just does not get the ID and nothing displays.

    Any idea why that does not work for child categories and how to get it to work?

  • #2 / Jul 11, 2012 4:47pm

    Dan Decker

    7338 posts

    Hi AirWatch,

    Thanks for posting your question on the Forums!

    It looks like you are using Seg2Cat?

    Have you turned on template debugging to see what ExpressionEngine is trying to return? Admin->System Administration-> Output and Debugging

    With debugging on you will be able to see what {last_segment_category_id} is being passed along as on the categories that aren’t working.

    I look forward to your reply!

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases