codeigniter 2 - Check a string in Smarty -
i have problem smarty framework, need verify if image name starts 'http': seek code:
{foreach from=$video->result() item=v} {if substr($v->image,0,4) eq 'http'} <img src="{$v->image}" alt=""> {else} <img src="{$img_url}videos/images/{$v->date|date_format:'%y'}/{$v->date|date_format:'%m'}/{$v->image}" alt=""> {/if} {/foreach} help me please..exists way?
this code should work fine. info not set properly.
consider next testing code:
php file:
class v { public $image = 'http://rwewreuiuiwre'; } $smarty->assign('v', new v()); template file:
{if substr($v->image,0,4) eq 'http'} http {else} non http {/if} it works fine. if alter $image hxttp non http message
smarty codeigniter-2 php-5.3 smarty3 smarty2
No comments:
Post a Comment