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.

Trim last letter and get the category id

August 01, 2013 4:36pm

Subscribe [2]
  • #1 / Aug 01, 2013 4:36pm

    spyro

    89 posts

    I have a situation where the category is singular and the url segment I have is plural.

    Example: I have the word “blogs” and need it to be “blog” so that I can get the category id

    So to do this I tried this combination below.
    {exp🐈id category_url_title="{exp:ce_str:ing replace_last='s|'}{segment_3}{/exp:ce_str:ing}”}

    However, this doesn’t work. Is there something I am doing incorrectly or is there another way to do it?

  • #2 / Aug 02, 2013 1:40am

    PravinS

    123 posts

    try using substr function like this

    substr(“blogs”, 0, -1);

  • #3 / Aug 02, 2013 5:37am

    Giraffentoast

    152 posts

    To avoid hacking (which might lead to errors in the future), why not link to the categories’ URL TITLE in the first place?

  • #4 / Aug 03, 2013 3:23pm

    Rob Allen

    3114 posts

    Or use Low’s seg2cat addon - http://gotolow.com/addons/low-seg2cat

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

ExpressionEngine News!

#eecms, #events, #releases