Forums / Setup & design / detecting front page

detecting front page

Author Message

Marko Žmak

Tuesday 06 July 2004 3:17:02 pm

How can I detect in a template if the current page is a first page?

I want to show a template section only when the user visits the page for the first time. Example:

If the URL of the page is:

http://www.mysite.com/index.php

then the section should be displayed.

And if it is:

http://www.mysite.com/index.php/mysite/forum/

then it should NOT.

How do I do this?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Alex Jones

Wednesday 07 July 2004 6:54:28 am

Marko, you can use the section tag to detect whether the main page is being displayed, and if it is show your content:

{section show=eq($DesignKeys:used.node,2)}
  Place the content to show up on the front page here.
{/section}

This compares the currently displayed node (<i>$DesignKeys:used.node</i>) against Node ID 2 (the default ID of the main page in an eZ install). If they are equal, it will show the contents, if not, it won't show anything.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>