set_file("Update","update.html"); $t->set_file("Links","links.html"); $t->set_file("index","index.html"); //---设置循环,读取更新信息 $t ->set_block("Update","RowUpdate","RowsUpdate"); $tmp=array_reverse(file("./templates/data/update.ex")); for($i=0;$i $info[$i]=explode("||",$tmp[$i]); $t->set_var(array("Update"=>$info[$i][1],"UpdateTime"=>$info[$i][2])); $t->parse("Rows" name=description>

InfoQ

交流

讨论:问一下各位PHPlib做循环输出时怎么做的?

作者 Elliott 发布于 0000-00-00 分类:php基础编程

[PHP]
<?
include("./templates/template.inc");
$t=new template("./templates/");//模版文件开始
$t->set_file("Update","update.html");
$t->set_file("Links","links.html");
$t->set_file("index","index.html");
//---设置循环,读取更新信息
$t ->set_block("Update","RowUpdate","RowsUpdate");
$tmp=array_reverse(file("./templates/data/update.ex"));
for($i=0;$i $info[$i]=explode("||",$tmp[$i]);
$t->set_var(array("Update"=>$info[$i][1],"UpdateTime"=>$info[$i][2]));
$t->parse("RowsUpdate","RowUpdate","true");
}
//---设置循环,读取链接信息
$t->set_block("Links","RowLinks","RowsLinks");
$tmplinks=file("./templates/data/links.ex");
for($i=0;$i $linksinfo[$i]=explode("||",$tmplinks[$i]);
$t->set_var(array("link"=>$linksinfo[$i][1],"url"=>$linksinfo[$i][2]));
$t->parse("RowsLinks","RowLinks","true");
}
//---读取标题,版权信息
$other=file("./templates/data/other.ex");
$t->set_var(array("title"=>$other[0],"copyright"=>$other[1]));
$t->parse("PutNews","RowsUpdate");
$t->parse("PutLinks","RowsLinks");
$t->parse("out","index");
//$t->p("PutNews");
//$t->p("PutLinks");
$t->p("out");
?>
[/PHP]
能是能成功..但要写3个$t->set_file和3个$t_parse....
我看教程上就用array()可是实现,但我怎么试都只会出现一个橍目的内容.
哪位能帮我修改下吗?thanks



逛论坛交流问一下各位PHPlib做循环输出时怎么做的?

加入书签
digg+,
reddit+,
del.icio.us+,
dzone+

0 条回复

回复




  1. 我有话要讲:(可以匿名发表, 发广告的有多远请滚多远!!!)

    昵称: 请输入验证码:


抢着回答

给大家一个webftp的地址,可以传zip文件

http://www.cqlc.net/webftp/

小问题一个?

我在数据库里的时间格式是datetime的,如2003-10-15 14:16:44 ...

高手请进!~

偶要做一个批量修改资料的程序,就是要读出所选择的复选框的值然...

请教一个比较难的问题,不知道php能否实...

PHP能不能做到这样的功能? 通过一些函数跟主机的其他应用程序...

foreach()跟if一樣嗎?

RT

初步订了个学习计划

看了短笛的招聘,我发现我学的东西太少了,决定从基本学起,先学...

帖个以前写的程序。。。是静态的,有兴...

/******************************************************* ...

打击一下单身的BOY---交女朋友的悲惨...

上大学的时候,一个女人说:只要你有吃饭看电影的钱我就跟你。 ...

关于表单的反灰

我设置了两个列表框(SELECT),我想写一小段JAVASCRIPT,当第一个...

求助:Discuz论坛引用新贴,怎么限制标...

麻烦谁能帮我改一下?谢谢了! <? $host="localhost"; $u...

[]