| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
#1
|
|||||||
|
|||||||
Smarty Vars
Hi all
Is there a way that i can pass the contents of a smarty variable to a php varible within {php} to perform php a php function? Basically Im trying to find a way of checking if a selected smarty variable contains a certain string IE.. does {$product.product} contain the word "Cheap" for example. Thanks all
__________________
X-cart Gold - 4.0.18 - 4.1.9 - 4.1.10 - 4.3.0 |
|||||||
#2
|
|||||||
|
|||||||
Re: Smarty Vars
Here's one way of doing it...
Code:
There's probably an easier way using smarty alone, I'll keep looking...
__________________
xcartmods.co.uk |
|||||||
#3
|
|||||||
|
|||||||
Re: Smarty Vars
{$product.product|strpos:"Cheap"}
problem with using strpos though is you need to run another check if "Cheap" is at the 0 position, if its not there strpos will still evaluate it as 0 so you need to use something like substr to compare if its actually at the 0 position or not |
|||||||
#4
|
|||||||
|
|||||||
Re: Smarty Vars
__________________
xcartmods.co.uk |
|||||||
|
|||
X-Cart forums © 2001-2020
|