| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Use variables from smarty in PHP | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
![]() Help guys!!!
![]() I'm trying to assign variable in welcome.tpl: { config_load file="special.tpl" } - works fine - get parsed to other tpl as {#specialid#} and tried this one {assign var="specialid" value="71"} - works too - get parsed to other tpl as {$specialid} how to use this variable in php script which is included in home.php like this: include "../modules/Special/special.php"; ??? Everything works if I hard code variable directly in php, but I have to send it from tpl Is there anything like "$smarty.specialid" to use in php scripts? Thank you |
|||||||||
#2
|
|||||||
|
|||||||
![]() Smarty is designed to do this the other way around, i.e. assign the variables in the php script and then give it to smarty to display through the template system.
__________________
ex x-cart guru ![]() |
|||||||
#3
|
|||||||||
|
|||||||||
![]() > Smarty is designed to do this the other way around
I know, but I have to send variable which is assigned by store admin. The easiest way would be assigned it in "Edit Templates" but I can not send it to php script. Any ideas on how to give admin ability to set some custom variable for the whole store whithout modifying php scripts every time? Thanks |
|||||||||
#4
|
|||||||||
|
|||||||||
![]() ![]() Wow! I love x-guys!!! All I had to do is Code:
and now I can use this variable in any php Code:
and master can modify it in "Control panel" -> "General" -> "Appearance" Could not be better! Uraaaa! to x-men! ![]() |
|||||||||
#5
|
|||||||
|
|||||||
![]() You could just refer to it in a template by:
Code:
__________________
ex x-cart guru ![]() |
|||||||
#6
|
|||||||||
|
|||||||||
![]() > You could just refer to it in a template
I know, but I have to get all product info for this id first from the database. Thank you |
|||||||||
#7
|
|||||||
|
|||||||
![]() No you dont, anything that has been entered in the config or languages table in xcart is automatically available right through the template.
Just need to type in as shown
__________________
ex x-cart guru ![]() |
|||||||
#8
|
|||||||||
|
|||||||||
![]() I needed admin to be able to enter product id for special product to display on home page:
Ex: http://www.ontoppaintball.com Yes, I have product id; but I also need product name, thumbnail, price and etc. for this product. Same as bestsellers module works but with only one product with id assigned by store admin. I get "$specialid" and use it in "special.php" to select all info for this product and store it in "$special". Now I can use all the info such as "$special.product", "$special.desc" and etc. in templates. So, adding this variable into templates was not enough. Yes, I could get tumbnail and link to product page, but not product name and price. |
|||||||||
|
|||
X-Cart forums © 2001-2020
|