| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
$main variable... where is it, and how can I use it? | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
$main variable... where is it, and how can I use it?
I am trying to find a way to tell xCart to open home.tpl with one header or another, based on which page I'm linking in to. I described my problem here: http://forum.x-cart.com/showthread.php?t=25821
I'm not getting any replies on that thread, so striking out on my own, one of my ideas is to use $main to determine what kind of page I linked to, and then use that in an {if} statement to select which header, column format, etc, to use. Can someone tell me how to use $main ? Where is it, how do I read it, and where does it get its value? Can I define other values that it can take? Thanks.
__________________
xcart v4.0.18 [linux] Loyalty Points, DSEFU, Easy Checkout, Featured Product Manager, Remember Me, Relevant Search, Vertical Flyouts, Multiple Category Templates. Loads of other tweaks and mods learned in forums. |
|||||||
#2
|
|||||||||
|
|||||||||
Re: $main variable... where is it, and how can I use it?
$main is a smarty variable that is assigned in a PHP file. For example...your product.php page has a variable of 'product'. Look for this in the PHP file
PHP Code:
or PHP Code:
You can then use an {if} {else} statement to load different templates. For example: HTML Code:
|
|||||||||
#3
|
|||||||||
|
|||||||||
Re: $main variable... where is it, and how can I use it?
The $main variable is set in various places depending on which file/page is being called. $main is aptly named because it determines what content is displayed in the main content area.
In it's basic form, a php file assigns a $main variable to smarty in the form: Code:
This main variable is then read in skin1/customer/home_main.tpl in the form: Code:
somefolder/something.tpl is then a file that displays the content in the main area. You can use the $main variable in your skin1/customer/home.tpl (or elsewhere) to use distinguishing headers in the form: Code:
Hope this helps. |
|||||||||
#4
|
|||||||
|
|||||||
Re: $main variable... where is it, and how can I use it?
Thanks, gentlemen. This is exactly what I needed.
Not only that, but I get to see it in two different "translations", which makes it crystal clear for me, a rank newb!
__________________
xcart v4.0.18 [linux] Loyalty Points, DSEFU, Easy Checkout, Featured Product Manager, Remember Me, Relevant Search, Vertical Flyouts, Multiple Category Templates. Loads of other tweaks and mods learned in forums. |
|||||||
|
|||
X-Cart forums © 2001-2020
|