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


How to use _extra dynamically in smarty {html_select_time}

我这里有一个问题。我可以在{html_select_time}中添加额外的值,比如hour_extra='id="hour_id"'。但我想动态地添加这个。如何做到这一点?请帮助

我的代码在下面

{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}

这里它不工作。由于

这可能是您需要的:

{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中测试)