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.

how to determine what page we are on?

September 06, 2007 11:03pm

Subscribe [2]
  • #1 / Sep 06, 2007 11:03pm

    mark b

    1 posts

    is there a way to determine inside a template what page it is currently displaying? e.g. if i have an embed for the site logo, i want to wrap it with a link back to the home page everywhere except the home page, but i don’t want to create a separate embed just for the home page template.

    so far the best i’ve come up with is

    {if segment_1 == ""}[unlinked logo]{if:else}[linked logo]{/if}

    which works fine for this but i still wonder if there is a segment_0 or something that spits out the whole path.

  • #2 / Sep 07, 2007 12:24am

    PXLated

    1800 posts

    There really isn’t a segment_0. Your conditional works as long as a person is coming to, and all your home page links take one to…
    http://www.site.com/ ...or… http://www.site.com/index.php/

    But, people can also get at it with…
    http://www.site.com/index.php/baseTemplateGroup/designatedHomepageTemplate/

    You’re probably ok the way you have it but if for some reason people might hit the full url you could add conditionals for that possibility.

  • #3 / Sep 07, 2007 2:21am

    mark b

    1 posts

    hm, good point… i’ll want to take care of that alternative path with mod_rewrite so that people never see it in the first place.

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

ExpressionEngine News!

#eecms, #events, #releases