php - Access smarty loop property in included file? -
when using smarty provides few useful @properties
on looping key such @first
@last
, @iteration
.
but seems in loops like
{foreach $collection $item} {include file="something_else.tpl"} {/foreach}
we seem lose @properties
.
if want access properties there more elegant way passing properties included file?
{foreach $collection $item} {include file="something_else.tpl" first=$item@first last=$item@last iter...} {/foreach}
basically no. maybe can use mixed syntax. add name foreach , try access properties via {$smarty.foreach.name.property}.
http://www.smarty.net/docs/en/language.variables.smarty.tpl (search $smarty.foreach.)
Comments
Post a Comment