Php 在桌子上重复
我桌上有个问题 问题是重复 我想当它达到4行时,表被转移到新行 PHP代码:Php 在桌子上重复,php,html,while-loop,html-table,smarty,Php,Html,While Loop,Html Table,Smarty,我桌上有个问题 问题是重复 我想当它达到4行时,表被转移到新行 PHP代码: // for : $tr = 1; while($row = mysql_fetch_array($post_tv)){ $show[] = $row; if ($tr == 4){ $tr == 1; } $tr++; $marsosmarty->assign("show",$show); $marsosmarty->assig
// for :
$tr = 1;
while($row = mysql_fetch_array($post_tv)){
$show[] = $row;
if ($tr == 4){
$tr == 1;
}
$tr++;
$marsosmarty->assign("show",$show);
$marsosmarty->assign("tr",$tr);
}
代码Html smarty:
<td width="91"><table width="100" height="100" border="0" cellpadding="1" cellspacing="1" bgcolor="#666666">
<tbody><tr>
{section name=table loop=$show}
{if $tr eq 3} </tr><tr> {/if}
<td bgcolor="#FFFFFF">
<a href="./channel.php?id={$show[table].id}" target="az">
<img src="{$show[table].a_IMG}" alt="{$show[table].a_DESC}" width="100" height="100" border="0" class="link-img" title="{$show[table].a_TITLE}">
</a>
</td>
{/section}
</tr>
{节名=表循环=$show}
{if$tr eq 3}{/if}
{/section}
使用以下代码。在代码中将tr与值进行比较时,必须指定
if ($tr == 4){
$tr = 1;
}
什么问题,什么不起作用?我不明白你的问题。请详细说明