Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

if statement for homepage

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-18-2007, 12:50 PM
 
bens bens is offline
 

Newbie
  
Join Date: Apr 2006
Posts: 5
 

Default 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.
__________________
Version 4.1.8
Reply With Quote
  #2  
Old 08-18-2007, 01:22 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #3  
Old 08-18-2007, 01:34 PM
 
bens bens is offline
 

Newbie
  
Join Date: Apr 2006
Posts: 5
 

Default 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}
__________________
Version 4.1.8
Reply With Quote
  #4  
Old 08-18-2007, 08:47 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default 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).
Reply With Quote
  #5  
Old 08-19-2007, 12:16 AM
 
bens bens is offline
 

Newbie
  
Join Date: Apr 2006
Posts: 5
 

Default Re: if statement for homepage

Exactly what I needed, Thanks !
__________________
Version 4.1.8
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:46 AM.

   

 
X-Cart forums © 2001-2020