2013-04-21 50 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