![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
相关问题
一下是我的代码
test.php
[php]
<?php
require_once("conn.php");
include("d:/apache/apache2/htdocs/smarty/class/smarty.class.php");
$tpl=new Smarty();
$tpl->templates="d:/apache/apache2/htdocs/smarty/templates/";
$tpl->templates_c="d:/apache/apache2/htdocs/smarty/templates_c/";
$tpl->configs="d:/apache/apache2/htdocs/smarty/configs/";
$sql = "select * from test order by id desc limit 0,8";
$query = mysql_query($sql);
while($result[] = mysql_fetch_array($query)){
$tpl->assign("result",$result);
}
//载入模板
$tpl->display("test.tpl");
?>
[/php]
test.tpl
[php]
{foreach from=$result item=text}
{/foreach}
[/php]
以上是两个文件的代码,将搜索结果按降续排列出来,是这样的,我想让最近的三个搜索结果,在旁边显示一个"new"的图片,请问这怎么实现呢?意思就是在最新的三条信息后边显示一个"new"图片.小弟先谢了啊!
[ 本帖最后由 thesea 于 2007-1-12 07:40 PM 编辑 ]
提问者:thesea 08-22 14:02
答复

