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 回答