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.

Can we check if we are on the 404 template page?

June 06, 2012 11:54am

Subscribe [2]
  • #1 / Jun 06, 2012 11:54am

    amityweb

    162 posts

    Hi

    I have a common header.html template file included on all pages including my 404 template, so there’s just one version of the site HTML.

    But in my header.html page I also am outputting some content depending on the {last_segment}.

    This results in an issue when someone goes to a template that does not exist, but a page that does, e.g.

    http://www.mydomain.com/madeuptemplate/about-us

    EE shows the 404 page because the template group does not exist, but then my common code I am using in the head is outputting some content based on the last_segment about-us because this does exist.

    Soooo I wondered if there is some code I can use to check if the user is on the 404 page, then I can not output this code then.

    Thanks

  • #2 / Jun 06, 2012 3:53pm

    amityweb

    162 posts

    Dont worry about this, I decided to put my common code in template files, then embed them in the single entry template files, and not have them in the header which was giving me the issue on the 404 page.

  • #3 / Jun 07, 2012 12:23pm

    Shane Eckert

    7174 posts

    Hey amityweb,

    Understood. Glad you got this figured out.

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases