PHP头条
热点:

横向重复区域显示二法


方法一. 注重这里有一个预先定义的图片记录集rsmpic 要横向重复的就是图片,请根据你的情况改为你的记录集名称.整洁地将横向重复内容放在一个表格内


<table width="100" border="0" align="center" cellpadding="5" cellspacing="5">

<?php $startrw = '0';// 开始定义横向重复内容 这里设定为 3 行 3 列
$endrw = $HLooper1__index;
$numberColumns = '3';
$numrows = '3';
while(($numrows <> 0) AND (!$rsmpic->EOF))
{
$startrw = $endrw 1;
$endrw = $endrw $numberColumns;?>

<tr>
<?php While (($startrw <= $endrw) AND (!$rsmpic->EOF)) { //开始重复内容?>

<td>
<table width="78%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../<?php echo $rsmpic->Fields('M_Path'); ?>" border="0"></td>
</tr>
</table>

</td>

<?php
$startrw = $startrw 1;
$rsmpic->MoveNext();}//以上重复td内容 ?>

</tr>

<?php $numrows=$numrows-1;
Wend; } //重复内容结束 ?>
</table>


方法二. 将重复标记拖到<td>外(纵向重复是在<tr>外),加入一个变量, 每重复 1 次加 1, 假如%3等于0 echo 一个"<tr>" . 请仔细看




<table width="100%" border="1" cellspacing="1" cellpadding="5">
<tr>
<?php $str=0;// 开始定义重复函数?>
<?php do { //开始重复?>

<td>
<?php $str ;?>
<?php echo $str; ?>.<?php echo $row_Recordset1['NAME']; ?>
</td>
<?php if ($str%3==0)echo "<tr>"; ?>

<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); // 重复td内容?>
</tr>

</table>

www.phpzy.comtrue/php/9083.htmlTechArticle横向重复区域显示二法 方法一. 注重这里有一个预先定义的图片记录集rsmpic 要横向重复的就是图片,请根据你的情况改为你的记录集名称.整洁地将横向重复内容放在一个表格内 table...

相关文章

    暂无相关文章
相关频道:

PHP之友评论

今天推荐