0

smarty 3 で次の配列から URL のリストを生成しようとしています。そのため、ループごとに [label] と [url] を出力する必要があります。

現時点で私は持っています:

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

これは空白行を出力するだけなので、テキストがなくても半分は機能します。

[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
        )
    )
)
4

1 に答える 1

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}
于 2012-01-26T21:27:41.500 に答える