![]() |
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 |
Re: Smarty Vars
Here's one way of doing it...
Code:
{php} There's probably an easier way using smarty alone, I'll keep looking... |
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 |
Re: Smarty Vars
|
All times are GMT -8. The time now is 02:55 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.