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.

Matching category_id with category_url_title

February 27, 2011 7:45am

Subscribe [3]
  • #1 / Feb 27, 2011 7:45am

    maxi

    220 posts

    On the all entries page I want to filter by category dynamically using url segments like this

    {exp:channel:entries channel="abc" category="{segment_3}" ...

    But I do not want to use category_id but category_url_title, is there a way to “link” the two together and have the category_url_title in the category=”” parameter of the entries tag?

    Thanks!

  • #2 / Feb 27, 2011 7:56am

    Mark Bowen

    12637 posts

    As there isn’t a parameter which can take the category url_title you will need to use something to convert them first. Take a look at Seg2Cat I’m pretty sure that should enable you to do what you need.

    Best wishes,

    Mark

  • #3 / Feb 27, 2011 8:33am

    maxi

    220 posts

    Ah right, is there any opening and closing tag to use the Seg2Cat tags? Or do I just use it like this?

    category="{segment_3_category_url_title}"
  • #4 / Feb 27, 2011 8:42am

    Mark Bowen

    12637 posts

    To tell the truth I’ve not really used the extension that much. I’m fairly certain it’s just the one tag but don’t hold me to that. Perhaps give it a go and see if it works or not though 😉

    Best wishes,

    Mark

  • #5 / Feb 27, 2011 8:48am

    maxi

    220 posts

    Got it! I needed to use

    category="{segment_3_category_id}"

    Thanks!

  • #6 / Feb 27, 2011 8:55am

    Mark Bowen

    12637 posts

    Got it! I needed to use

    category="{segment_3_category_id}"

    Thanks!

    Oops sorry! Didn’t see that you’d posted that other code above. Yep you would need to use that one in order to retrieve the category ID and not the url_title though 😉

    Glad you’ve got that figured though.

    Best wishes,

    Mark

  • #7 / Feb 28, 2011 3:33am

    John Henry Donovan

    12339 posts

    maxi,

    Note that the channel entries tag already filters by category when you are on category URL page.
    Did this not work for you?

  • #8 / Feb 28, 2011 4:38am

    maxi

    220 posts

    I’m on the all entries page, seg2cat did the trick 😊

  • #9 / Feb 28, 2011 3:28pm

    Ingmar

    29245 posts

    Glad to see you have a solution. Please don’t hesitate to post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases