Smarty PHP Template use PHP code ?

Gordon S

New member
FOUND ANSWER

{assign var=title_words value=" "|explode:$head_text}
Hi,

Can anyone advise if this is possible - WITHIN a Smarty template file ?

Basically the Smarty $head_text has 3 words, I'll like to use a small PHP script to 'explode' the words into an array, & use it later in the template file.

(the one template is used by multiple PHP scripts)

However, all I'm seeing is

0 -

(no words / extra lines)

Can anyone advise if possible ?

---------------

{php}
$test=explode(" ",$head_text);
$this->assign('title_words',$test);
{/php}

{foreach from=$title_words key=k item=i}
{$k} - {$i}<br />
{/foreach}
FOUND ANSWER

{assign var=title_words value=" "|explode:$head_text}
 
Back
Top