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.

Should {if category_request} be true for a .../category/... link?

December 13, 2008 5:46pm

Subscribe [3]
  • #1 / Dec 13, 2008 5:46pm

    Magnus Wester

    38 posts

    I get the impression that if you switch to Use Category URL Titles In Links you can no longer use the handy {if category_request} conditional. Is this true, and if so, is it by intention? Perhaps I did something wrong, but now {if category_request} never becomes true with my template.

  • #2 / Dec 13, 2008 6:16pm

    silenz

    1651 posts

    It ought to work and normally does. Are you using this conditional within a weblog:entries tag-pair?

  • #3 / Dec 14, 2008 4:26am

    Magnus Wester

    38 posts

    Oh, I didn’t change anything else but switch to Use Category URL Titles In Links. The site has been working fine for a long time.

    After further testing, it seems my problem is really with the {exp:weblog:category_heading} tag. I created a “test” template group and basically inserted the following code within the exp:weblog:entries tags of my template:

    {if count == 1}
    {exp:weblog:category_heading}<h1>{category_name}</h1>{/exp:weblog:category_heading}
    {if category_request}This is a category request.{if:else}This is not a category request.
    {/if}
    {/if} {!-- if first entry --}

    If you look at this page at http://bestwebconference.com/en/software-services/test/C34 (using the old notation) you can see that it correctly generates the <h1> header for the category.

    If you use the new notation like this: http://bestwebconference.com/en/software-services/test/category/reviews/ EE detects that it is a category request, but there is no <h1> header.

    The {exp:weblog:category_heading} tag does not appear to work the same if you use Category URL Titles. Is this intentional?

  • #4 / Dec 14, 2008 5:36am

    silenz

    1651 posts

    I don’t know if this is intentional, but the exp:weblog:category_heading-tag is not supposed to be inside exp:weblog:entries but on its own.

    If you move

    {exp:weblog:category_heading}<h1>{category_name}</h1>{/exp:weblog:category_heading}

    out of the weblog:entries loop, it ought to work just fine.

    Then you also don’t need the count==1 conditional and it only displays anything between its tags if it’s a category request so the if category_request is already implied.

  • #5 / Dec 14, 2008 8:15am

    Magnus Wester

    38 posts

    Thanks for your kind help, but moving the exp:weblog:category_heading tag out of the exp:weblog:entries construct does not solve the problem. The exp:weblog:category_heading tag still doesn’t detect a .../category/category_url_title/ request.

  • #6 / Dec 14, 2008 8:29am

    silenz

    1651 posts

    Have you set the weblog=”“-parameter in exp:weblog:category_heading?

    When using the category name in URL feature this is a must whereas you can ignore it if you’re using the /C24/-approach.

  • #7 / Dec 14, 2008 9:48am

    Derek Jones

    7561 posts

  • #8 / Dec 14, 2008 8:18pm

    Magnus Wester

    38 posts

    OK, now I get it, and it works fine as soon as I used the weblog parameter.

    I have updated the updating instructions for EE 1.6 to include this information.

    Many thanks for your kind help.

  • #9 / Dec 14, 2008 8:46pm

    Derek Jones

    7561 posts

    Thanks Magnus, though as a note, that parameter existed prior to version 1.6, and was always required when using the category trigger indicator in your URLs.

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

ExpressionEngine News!

#eecms, #events, #releases