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)
-   -   Page Specific "If" Statements (https://forum.x-cart.com/showthread.php?t=35080)

matthewstroh 10-31-2007 12:31 PM

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!

PhilJ 10-31-2007 01:13 PM

Re: Page Specific "If" Statements
 
Try this 'sticky' thread - http://forum.x-cart.com/showthread.php?t=8881

See this post also.

matthewstroh 10-31-2007 01:44 PM

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.

carpeperdiem 10-31-2007 03:18 PM

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...

geckoday 11-01-2007 05:09 AM

Re: Page Specific "If" Statements
 
Take a look at customer/home_main.tpl and for more esoteric stuff common_template.tpl

TelaFirma 11-01-2007 12:04 PM

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...


All times are GMT -8. The time now is 10:31 AM.

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