2012-01-26 4 views
0

Je suis en train de générer une liste d'URL à partir du tableau suivant dans Smarty 3. Donc, pour chaque boucle, je aurais besoin de sortir le [label] et [url]boucle de section Smarty un tableau

En ce moment je ont:

{section name="foo" loop=$list.options} 
{if $list.options[foo] != "names"} 
    {$list.options[foo].label} 
    {$list.options[foo].url} 
{/if} 
{/section} 

Ceci produit juste des lignes vides afin qu'il travaille à moitié juste aucun texte.

[list] => Array (
    [type] => Table 
    [name] => list 
    [options] => Array (
     [names] => Array (
      [0] => id 
      [1] => name 
      [2] => url 
      [3] => picture 
      [4] => featured 
     ) 
     [id] => Array (
      [enabled] => 1 
      [label] => Id 
      [url] => /admin/list/desc 
     ) 
     [name] => Array (
      [enabled] => 0 
      [label] => Name 
      [url] => /admin/list/desc 
     ) 
     [url] => Array (
      [enabled] => 0 
      [label] => Uri 
      [url] => /admin/list/desc 
     ) 
     [picture] => Array (
      [enabled] => 0 
      [label] => pciture 
      [url] => /admin/list/desc 
     ) 
     [featured] => Array (
      [enabled] => 0 
      [label] => Featured 
      [url] => /admin/content/list/desc 
     ) 
    ) 
) 

Répondre

0
{section name="foo" loop=$list.options.names} 
{if $list.options[foo] != "names"} 
{assign var="row" value=$list.options[$list.options.names[foo]]} 
     {$row.label} 
     {$row.url} 
{/if} 
{/section}