Chinaunix首页 | 论坛 | 博客
  • 博客访问: 113557
  • 博文数量: 16
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 380
  • 用 户 组: 普通用户
  • 注册时间: 2007-01-05 09:24
文章分类

全部博文(16)

文章存档

2011年(1)

2008年(15)

我的朋友

分类:

2008-04-18 14:05:05

<?php
include_once("./smarty/Smarty.class.php");
include_once("./lib/conn.php");

$s = new Smarty;
//$s->caching = true;//开启缓存功能

$s->template_dir = './tpl';
$s->compile_dir = './compile';
$s->cache_dir = './cache';
$sql="select * from class";
$re=mysql_query($sql);

while($k=mysql_fetch_array($re))
{    
    $sql="select * from content where class=$k[id]";
    $ree=mysql_query($sql);
    $news=array();
    while($sub=mysql_fetch_array($ree))
    {    
        $news[]=$sub;
    }
    $k[news_list]=$news;
    $cat_news[]=$k;
}

$s->assign("ss",$cat_news);
$s->display("main.html");

?>

{foreach item=list from=$ss}
    {$list.class_name}<br />
    {foreach item=sub_list from=$list.news_list}
        &nbsp;&nbsp;{$sub_list.title}<br />
    {/foreach}
{/foreach}

阅读(1998) | 评论(1) | 转发(0) |
0

上一篇:SELECT

下一篇:一个对超长标题截断的函数

给主人留下些什么吧!~~

chinaunix网友2009-01-05 17:38:00

呵呵!赐教。。。