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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -