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.

if:else question

June 25, 2007 7:24pm

Subscribe [3]
  • #1 / Jun 25, 2007 7:24pm

    pirco

    218 posts

    ok, I’m dumbstuck today. I have a template that I’m using for my home page (main listing of entries) as well as my category listing page (lists all entries that belong to a given category):

    {exp:weblog:category_heading weblog="{my_weblog}"}<h2>{if category_name}{category_name}{if:else}All Entries{/if}</h2>{/exp:weblog:category_heading}

    so I’d like to add a header that either reads “All Entries” (if it’s the homepage) or “category name” (if it’s a category listing page).

    while the category name header shows up perfectly on the category listing pages, on the homepage I get nothing?

    can anybody tell me why?

    thanks (and sorry in advance if this is silly. my brain is still on holiday).

  • #2 / Jun 25, 2007 8:36pm

    pirco

    218 posts

    ok, so it just occured to me that {exp:weblog:category_heading…} doesn’t get executed on the homepage (because there is no category_heading). so, for now, I’m just checking the URI to see if there is a segment_2 or something. or is there a better way to check if this is a category listing page?

    thanks.

  • #3 / Jun 25, 2007 9:54pm

    Sue Crocker

    26054 posts

    Hi, pirco.

    Which version/build of EE? You can find that out in the bottom of each CP page.

    Are you using Use Category URL Titles In Links?

  • #4 / Jun 26, 2007 5:32am

    Ingmar

    29245 posts

    Look into {if_category_request}.

  • #5 / Jun 26, 2007 7:33am

    Sue Crocker

    26054 posts

    Ingmar is mostly correct, it’s

    category_request

    EEDocs:// category_request

    See the example in the docs.

  • #6 / Jun 26, 2007 11:05am

    Ingmar

    29245 posts

    Dang. Never give advice without consulting the docs 😊

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

ExpressionEngine News!

#eecms, #events, #releases