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

Page Specific "If" Statements

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-31-2007, 12:31 PM
  matthewstroh's Avatar 
matthewstroh matthewstroh is offline
 

Member
  
Join Date: Oct 2007
Location: Portland, OR.
Posts: 16
 

Question Page Specific "If" Statements

I know how to make a .tpl file include (or not) on the Homepage by using a specific {if} statement (see below) and another to include somethign based on the category number (also below). But what are the statements I can make for the other pages? For example, what do I write to get a file to include only on the Contact Us page? In my store I have a .tpl file that displays which days the physical store is open. On the contact page, I'd like to include this file on my Contact Us but not on all the other ancillary pages like the cart, or the news page.

IF STATEMENT TO HIDE CART INFO ON HOMEPAGE
{if $main ne "catalog" OR ($main eq "catalog" and $current_category.category ne "")}
{include file="customer/menu_cart.tpl"}
{/if}

IF STATEMENT TO SHOW SOMETHING BASED ON CATEGORY
{if $cat eq "211"}Show This{/if}



I'm quite the newbie getting in and configuring my first store. So far so good. This forum is amazing resource!
__________________
Matthew Stroh
Version 4.1.9
Reply With Quote
  #2  
Old 10-31-2007, 01:13 PM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: Page Specific "If" Statements

Try this 'sticky' thread - http://forum.x-cart.com/showthread.php?t=8881

See this post also.
__________________
xcartmods.co.uk
Reply With Quote
  #3  
Old 10-31-2007, 01:44 PM
  matthewstroh's Avatar 
matthewstroh matthewstroh is offline
 

Member
  
Join Date: Oct 2007
Location: Portland, OR.
Posts: 16
 

Default Re: Page Specific "If" Statements

Brilliant, PhilJ. I had already read the 'sticky' thread with no help on my specific issue but it was very informative with other {if} statments I'll use eventually. The post about the Webmaster Mode was very, very helpful. For my specific query, I simpy needed to know that the help section is $main eq "help" and webmaster mode showed me that.
__________________
Matthew Stroh
Version 4.1.9
Reply With Quote
  #4  
Old 10-31-2007, 03:18 PM
 
carpeperdiem carpeperdiem is offline
 

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

Default Re: Page Specific "If" Statements

Matthew, are you hip to this thread? It was invaluable to me. Discovering things such as:

{if $main eq "pages" and $page_data.pageid eq "2"}

(for static embedded pages)

etc...
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #5  
Old 11-01-2007, 05:09 AM
 
geckoday geckoday is offline
 

X-Wizard
  
Join Date: Aug 2005
Posts: 1,073
 

Default Re: Page Specific "If" Statements

Take a look at customer/home_main.tpl and for more esoteric stuff common_template.tpl
__________________
Manuka Bay Company
X-Cart Version 4.0.19 [Linux]

UGG Boots and other fine sheepskin products
http://www.snowriver.com
Reply With Quote
  #6  
Old 11-01-2007, 12:04 PM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default Re: Page Specific "If" Statements

Quote:
Originally Posted by matthewstroh
... For example, what do I write to get a file to include only on the Contact Us page? ...

If I am reading this correctly, all you need to do is open the Contact Us template (/skin1/help/contactus.tpl) and insert the line:

{include file="yourpathandfile.here"}

no if's needed...
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 02:17 PM.

   

 
X-Cart forums © 2001-2020