2013-04-21 49 views
0

我有一个加密的脚本,我无法修改PHP文件,只是HTML模板文件,我试图修改某些页面。Smarty - 在foreach列表中添加html标记

我想要做的是填充一些类别的列表,但在我想添加一个HTML标签的特定数量的类别之后。我在管理控制台中选择了此选项,但视频不适用于类别。对于视频,我有这样的代码:

  {foreach from=$array_recently_added_videos item=video name=videos} 
<div class="video"> 
html code here.. 
</div> 

     {if ($smarty.foreach.videos.index+1)%$aSettings.videos_cols==0}<br class="clear">{/if} 
     {foreachelse} 
      <center><br><b>No videos where found.</b><br></center> 
     {/foreach} 

所以,如果我在管理面板中设置5列视频。 5视频后,它广告这段html代码

<br class="clear"> 

我想要做类似的。在这里我迷路了。这是我的代码。

{foreach from=$array_groups[$group_id] item=categ name=categs} 

            <input type='checkbox' name='{$categ.category_id}' value='{$categ.category_id}' id='{$categ.category_id}' ><label for='{$categ.category_id}' >{$categ.category_name}</label><br> 

     {if ($smarty.foreach.categs.index+1)%$aSettings.videos_cols==0}</td><td valign='top' align='left'>{/if}    

{/foreach} 

它增加了这一块的HTML代码</td><td valign='top' align='left'>后5个类别,但我想添加的类别自定义数字不是视频设置的号码。我不知道该怎么改变这个代码%$aSettings.videos_cols==0

回答

0

变化,

{if ($smarty.foreach.categs.index+1)%$aSettings.videos_cols==0}</td><td valign='top' align='left'>{/if}    

{if ($smarty.foreach.categs.index+1)%5==0}</td><td valign='top' align='left'>{/if}    

只是更改号码5

+0

非常感谢您! – 2013-04-21 18:55:17