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.

Convert category name to category ID?

February 08, 2010 8:00am

Subscribe [2]
  • #1 / Feb 08, 2010 8:00am

    daulex

    152 posts

    Hi,

    I did a decent amount of searching, couldn’t find anything, so here goes.

    This is what I want:

    site.com/category1 - lists everything under category1
    site.com/category1/sub1 - lists everything under sub1

    I’m using a template to achieve this, now essentially, what I want to achieve is:

    {exp:channel:entries channel="products" limit="5" category="{if "{segment_2}"}{segment_2}{if:else}{segment_1}{/if}"}

    This fails as the category (as far as I understand) only takes id numbers, as apposed to names, any ideas how to get the id from the names and then to feed the id’s into the code above?

    Thanks dudes.

  • #2 / Feb 08, 2010 12:55pm

    Kevin Gerich

    213 posts

    You could use the query module.

    Jim

  • #3 / Feb 08, 2010 1:02pm

    Mark Bowen

    12637 posts

    Take a look at the Low Seg2Cat extension I’m pretty sure it should allow you to do what you need.

    Hope that helps a bit.

    Best wishes,

    Mark

  • #4 / Feb 09, 2010 7:53am

    daulex

    152 posts

    I used the seg2cat plugin and failed miserably as pagination breaks the whole thing. I submitted a feature request to Low, hopefully the next version will do the trick…

    Until then… we abandoned sub-categories :D

    Thank you guys.

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

ExpressionEngine News!

#eecms, #events, #releases