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>

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 09:10:03
Script start
Timing: Jan 31 2025 09:10:03
Module start 'layout'
Timing: Jan 31 2025 09:10:03
Module start 'content'
Timing: Jan 31 2025 09:10:03
Module end 'content'
Timing: Jan 31 2025 09:10:03
Script end

Main resources:

Total runtime0.0185 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 588.1328151.2109
Module start 'layout' 0.00630.0030 739.343836.6484
Module start 'content' 0.00920.0073 775.992290.1563
Module end 'content' 0.01660.0019 866.148429.9922
Script end 0.0184  896.1406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002714.3948140.0002
Check MTime0.00116.0845140.0001
Mysql Total
Database connection0.00158.365810.0015
Mysqli_queries0.002513.376830.0008
Looping result0.00000.081410.0000
Template Total0.00147.510.0014
Template load0.00115.830010.0011
Template processing0.00031.635410.0003
Override
Cache load0.00073.819910.0007
General
dbfile0.001910.382480.0002
String conversion0.00000.043940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs