X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   if statement for homepage (https://forum.x-cart.com/showthread.php?t=33345)

bens 08-18-2007 12:50 PM

if statement for homepage
 
I would like display location.tpl on every page except for the homepage. Is there an {if} statement I can incorporate into home.tpl to do this.

carpeperdiem 08-18-2007 01:22 PM

Re: if statement for homepage
 
in file, skin1/customer/home.tpl

FIND:
Code:

{include file="location.tpl"}
REPLACE WITH:
Code:

{if $main eq "catalog" and $current_category.category ne ""}
{include file="location.tpl"}
{/if}


Basically, if the current category is not empty, show location.tpl. Ok?

Hope this works for you.

--Jeremy

bens 08-18-2007 01:34 PM

Re: if statement for homepage
 
Thanks for that, points me in the right direction, used the following so it shows on product.tpl as well

{if $current_category.category ne ""}
{include file="location.tpl"}
{/if}

Jon 08-18-2007 08:47 PM

Re: if statement for homepage
 
Every page except the home page would require:

Code:

{if $main ne "catalog" OR ($main eq "catalog" and $current_category.category ne "")}
{include file="location.tpl"}
{/if}

Code:



Here's the code break-down:

$main ne "catalog" - If the page is not the home page or a category
OR ($main eq "catalog" and $current_category.category ne "") - If we are on the home page or the category, only show location.tpl if there is a category specified (i.e. not the homepage).

bens 08-19-2007 12:16 AM

Re: if statement for homepage
 
Exactly what I needed, Thanks !


All times are GMT -8. The time now is 04:39 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.