日期:2014-05-17  浏览次数:20501 次

phpli连接一个表,让他安不同的方循环出来
php文件
 $sql = "SELECT * FROM `pp_vod` where vod_cid = 8 order by vod_addtime LIMIT 0 , 12";
$query = mysql_query($sql);
  $i = mysql_num_rows($query);
  $j = 0;
while($a = mysql_fetch_array($query)){
if ( $j <= $i){

  $id[$j] = $a['vod_id'];
  $area[$j] = $a['vod_area'];
  $hits[$j] = $a['vod_hits'];
  $title[$j] = $a['vod_name'];
  $author[$j] = $a['vod_actor'];
  $authoreml[$j] = $a['authoreml'];
  $putdate[$j] = $a['vod_addtime'];
$pic[$j] = $a['vod_pic'];
$cat[$j] = $a['vod_cid'];
$content[$j] = $a['vod_content'];
   
  $j++;
  }
}
 


$t->set_file("main","3333.htm");


$t -> set_block("main","row","rows");
  for($j = 0; $j < 12; $j++){
  $t -> set_var(array("authoreml" => $authoreml[$j],
  "author" => $author[$j],
  "id" => $id[$j],
  "title" => $title[$j],
  "putdate" => $putdate[$j],
"pic" =>$pic[$j]));
  $t -> parse("rows","row",ture);
  }

$t->parse("out","main",true);
/*
此方法共有三个参数,目前我们先只用前两个.第一个参数为一会要输出的名称,第二个参数为之前定义模板文件时的名称.
*/
//输出
$t->p("out");
模板文件
<ul class="htext">
<!-- BEGIN row -->

<li><a href="http://www.dy58168.com/vod/{id}.html" title="{title}">{title} <font color="#6c6c6c">全集</font></a><span>{putdate}</span></li>
<!-- END row -->

这个是安添加时间循环出来的,去还要让他安点击循环出来怎么办??一个一个写出来太多了

------解决方案--------------------
这么古老的模板引擎,估计现在是没人用了。
不过这不是问题的关键

关键在于:实在没法理解你的需求
这个是安添加时间循环出来的,去还要让他安点击循环出来怎么办??一个一个写出来太多了