View Full Version : how do i detect front page?
parisp
05-02-2006, 12:51 PM
I am creating a custom template and i would like to know if there is a proper way to detect if the home/index is loaded.
say i want the footer to include another table/block of buttons if we are in the front page. however i dont want this to be displayed in other pages.
any help will be apreciated
thanks
will show my work soon to tell me if you like it
Hi
If you want something to only show on home page try this.
{if $category.id == 0}
(here is the HTML code for the box which should be shown only on the home page)
{/if}
tisoy
05-06-2006, 01:15 AM
how can we also set to display only on these pages?
Search
New Links
Top Links
Popular Links
parisp
05-10-2006, 09:20 AM
thanks greg you are a charm, will try it on now... and it works :) superb
Nick Collins
05-16-2006, 04:17 AM
how can we also set to display only on these pages?
Search
New Links
Top Links
Popular Links
Do you want to hide Home, Suggest Link and Suggest Category buttons from all pages?
Hey Nick!
I am loosing my mind trying to figure this out. :wallbash:
Lets take FireAndIce template for an example.
There is left column with main categories in it and it is displayed on all pages.
I want to hide this column from index page only.
I tried to use:
{if $category.id > 0}
(left column with main cats)
{/if}
but this way my column will be also hidden on "Links details", "Search", "Top links" and other pages except category pages.
Is there a way to exclude main index page only and keep all other pages???
Thanks
Nick Collins
05-16-2006, 06:28 AM
I believe that Simon can suggest better way to achieve this goal, but my code bellow is work perfect also:
{if $category.id neq 0}
<div class="box">
<div class="box-caption">Main {$lang.categories}</div>
<div class="box-content">
{foreach from=$top_categories item=top_category}
<p class="top-category">{$top_category.title} ({$config.base}{$config.dir}{$top_category.path }/)</p>
{/foreach}
</div>
</div>
{elseif $tab neq 'home'}
<div class="box">
<div class="box-caption">Main {$lang.categories}</div>
<div class="box-content">
{foreach from=$top_categories item=top_category}
<p class="top-category">{$top_category.title} ({$config.base}{$config.dir}{$top_category.path }/)</p>
{/foreach}
</div>
</div>
{/if}
This code is actual for PRO 1.2
Perfect!
This is the element I could not figure out:
...{elseif $tab neq 'home'}...
Thanks Nick! :applause:
Nick Collins
05-18-2006, 08:21 AM
No problem, you are welcome!
Olaf Lederer
10-08-2006, 04:16 PM
Hi
If you want something to only show on home page try this.
{if $category.id == 0}
(here is the HTML code for the box which should be shown only on the home page)
{/if}
This is fine for the categorie pages but what about pages like top and New links?
Dave Baker
10-22-2006, 05:53 PM
Hello Olaf,
I think it will help you:
{if $tab eq "popular-links"}
(here is the HTML code for the box which should be shown only on the Popular Links page)
{/if}
{if $tab eq "new-links"}
(here is the HTML code for the box which should be shown only on the New Links page)
{/if}
{if $tab eq "top-links"}
(here is the HTML code for the box which should be shown only on the Top Links page)
{/if}
Olaf Lederer
10-22-2006, 09:05 PM
Hello Dave,
I don't think that this is the solution, you need this code:
{if $category.id == 0 && $tab eq 'home'}
<p style="margin:10px 0 0 5px;">
<a href="http://www.free-pagerank-checker.com/" title="Free PageRank checking tool" target="_blank">
<img src="http://www.free-pagerank-checker.com/pr.php?url=www.1linkdirectory.com" border="0" alt="PageRank" />
</a>
</p>
{/if}
Dave Baker
10-22-2006, 10:33 PM
This is fine for the categorie pages but what about pages like top and New links?
{if $category.id == 0 && $tab eq 'home'}
<p style="margin:10px 0 0 5px;">
<a href="http://www.free-pagerank-checker.com/" title="Free PageRank checking tool" target="_blank">
<img src="http://www.free-pagerank-checker.com/pr.php?url=www.1linkdirectory.com" border="0" alt="PageRank" />
</a>
</p>
{/if}
The decision offered by you should work on event presence the user on the main page of directory.
Olaf Lederer
10-22-2006, 10:41 PM
[code]
The decision offered by you should work on event presence the user on the main page of directory.
The question was about how to detect the mainpage...
Dave Baker
10-23-2006, 12:12 AM
I like these main pages too.... :sorry:
http://www.esyndicat.com/forum/post49435-10.html
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.