Reversing Smarty Foreach Loop Output

travelvice
travelvice's picture

Joined: 2005-07-16
Posts: 112
Posted: Tue, 2008-01-08 09:16

Howdy,

I'm looping through the names of parent albums, and was trying to figure out how I might output the results from last to first, instead of first to last...

 {foreach name=parent from=$theme.parents item=parent}
  {if !$smarty.foreach.parent.first}
   {$parent.title|markup:strip|default:$parent.pathComponent},
   {/if}
 {/foreach}
 
travelvice
travelvice's picture

Joined: 2005-07-16
Posts: 112
Posted: Tue, 2008-01-08 09:28

Ah, well - asked that one too soon.

Solution:

from=$theme.parents|@array_reverse