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

If else function on home.php

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 06-10-2007, 08:06 PM
 
yuichi yuichi is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 42
 

Default If else function on home.php

Hi guys,
I am looking for a code that displays only in home.php

example:

Quote:
{if current page = home.php }
{ include file="some file " }
{/if}

I know php, but am new to smarty..
Basically what I did was I inserted an image tpl right before "welcome" text, but now, the image tpl appears in every page including category page and each individual item page...
How can I just display on home.php?
__________________
X-Cart Ver: 4.1.9 Gold
X-Cart Ver: 4.1.10 Gold
Reply With Quote
  #2  
Old 06-10-2007, 09:35 PM
  Jon's Avatar 
Jon Jon is offline
 

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

Default Re: If else function on home.php

Code:
{if $main eq "catalog" AND $current_category eq ""} Show Image Code {/if}
Reply With Quote
  #3  
Old 06-12-2007, 12:49 PM
 
yuichi yuichi is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 42
 

Default Re: If else function on home.php

Thankyou!!
What does $main and $current_category mean?
That seems like a variable to me..?

Also we can write the opposite code too ?
Quote:
{ if $main neq "catalog" AND $current_category neq ""}
Do this
{/if}

__________________
X-Cart Ver: 4.1.9 Gold
X-Cart Ver: 4.1.10 Gold
Reply With Quote
  #4  
Old 06-13-2007, 01:58 PM
  Jon's Avatar 
Jon Jon is offline
 

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

Default Re: If else function on home.php

$main and $current_category are both variables.

$main is a variable that is used to tell the internal workings what page to load. When $main eq "catalog" it is either loading the main page, or a category.

When loading a category, the $current_category variable is populated.

So the code I provided loads when the catalog section is loaded (main or category page) and when the $current_category variable is empty (so we know we are on the main page and not a category page).

Yes you can write the opposite, whether or not it will do what you want depends on what you want to accomplish
Reply With Quote
  #5  
Old 06-13-2007, 06:09 PM
 
yuichi yuichi is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 42
 

Default Re: If else function on home.php

Thankyou for your kind answer! Things are getting a little clear once I started to understand the consept. It's still different from standard PHP, so I have a hard time, but hopefully I get it!

Thanks again!!!
__________________
X-Cart Ver: 4.1.9 Gold
X-Cart Ver: 4.1.10 Gold
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 06:37 AM.

   

 
X-Cart forums © 2001-2020