Re: [SMARTY] Question on componentized templates
[email protected] (Robert Hazeltine) Tue, 9 Jan 2007 06:20:12 +1100 (EST)
| Newsgroups | php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Jochem
On Mon, 8 Jan 2007, Jochem Maas wrote:
> Robert Hazeltine wrote:
>> Hi
>>
>> I'm new to the use of Smarty templates so I hope someone can assist with
>> my question. Is it possible to substitute a variable in in following
>> example - ie symbol = $smarty. Is there some reason, I cannot do this
>> but, if I can, how?
>>
>> Example:
>>
>> $smarty = "YAHOO";
>>
>> {load_ticker symbol='SMARTY' assign='ticker'}
>> {load_ticker symbol='{$smarty}' assign = 'ticker'}
>
> in your php file:
>
> // $smarty is a Smarty object
> $smarty->assign('TickerSymbol', 'YAHOO');
>
> in your template:
>
> {load_ticker symbol=$TickerSymbol assign='ticker'}
Thanks. It now works perfectly.
Robert