如何在smarty中动态使用_extra {html_select_time}

时间:2014-05-17 11:10:32

标签: php html smarty

我这里有问题。我可以在hour_extra='id="hour_id"'中添加{html_select_time}之类的额外价值。但我想动态添加它。这该怎么做?请帮忙

我的代码如下。

{section name=foo start=2 loop=18 step=1}
    {assign var="itt" value=$smarty.section.foo.index}
       {html_select_time prefix=pre$itt use_24_hours=false display_seconds=false minute_interval=5 time="00:00" hour_extra='id="$itt"' }
{section}

这里不起作用。 感谢

1 个答案:

答案 0 :(得分:0)

这可能就是你所需要的:

{section name=foo start=2 loop=18 step=1}
    {assign var="itt" value=$smarty.section.foo.index}
        {html_select_time prefix="pre{$itt}" use_24_hours=false display_seconds=false minute_interval=5 time="00:00" hour_extra="id='{$itt}'" }
{/section}

(在Smarty 3.1.18中测试)