Reputation: 1133
I tried this way,but seems not working:
{if $i == 1}
$value = $recommend[3];
{/if}
Does smarty support assignment operation?
Upvotes: 2
Views: 3402
Reputation: 48897
To assign variables within a template, do:
{if $i == 1}
{assign var='value' value=$recommend[3]}
{/if}
Upvotes: 4
Reputation: 1682
Another option besides assign() ( which is probably better from separation of code and presentation point of view) is http://www.smarty.net/manual/en/language.function.php.php
Upvotes: 0
Reputation: 382776
There is assign()
method for that. Check it out here:
http://www.smarty.net/manual/en/api.assign.php
Upvotes: 1