找回密码
 注册
搜索
热搜: 回贴
微赢网络技术论坛 门户 网络编程 PHP 查看内容

adodb+smarty+myClass 结合:数据类的智能操作

2009-12-21 17:48| 发布者: admin| 查看: 40| 评论: 0|原作者: 小寳寳

";
}


$smarty->assign('total',$total);

$smarty->assign('musicArr',$musicArr);

$my->close();
$smarty->display('music.htm');
require("include/footer.php");
exit();
?>


music.htm
/**
*
* @author 风卷残云,
* @copyright Copyright (c) 闲情网站, 2004-2005
* @since ~
*/
/*+++++++++++++++++++++++++
* Copyright (c) 2004,闲情网站
* All rights reserved
*
* 系统名称:闲情音乐
* 文件名称:diary.php
* 文件标识:见配置管理计划书
* 功 能:
* 摘 要:
*
* 当前版本:1.0
* 作 者:风卷残云
* 作者主页:http://freeday.512j.com
* 作者邮箱:bighuang@126.com
* 作者 QQ:121173553
* 完成日期:2005年4月3日
*
* 取代版本:1.0
* 原 作 者:风卷残云
* 完成日期:2005年4月3日
+++++++++++++++++++++++++*/
include "config/config.php";
include "config/dbclass.php";
include "include/FreeDayCodeChange.php";
$my = new mydb();
$my->c_all($db_host,$db_user,$db_psw,$db_table);
//require("include/sess.php");

$my = new mydb();
$my->c_all($db_host,$db_user,$db_psw,$db_table);

require("include/header.php");
require("config/Smarty_Freeday.php");

$smarty = new Smarty_Freeday;

$query = "select count(*) from fd_music order by MC_id desc";
$res =$my->query($query);
$total = $my->fetch_arr($res);
$total = $total[0];


$queryN = "select * from fd_music order by MC_id desc";
$result =$my->query($queryN);
$i = "0";
$j = "1";
$musicArr = array();
if ($result)
{
while ($n = $my->fetch_arr($result))
{

$i ++;
$musicItem[$j-1][name] = $n[MC_name];
$musicItem[$j-1][songer] = $n[MC_songer];
$musicItem[$j-1][url] = $n[MC_url];
$j ++;



if($i==$total && $j%5!=0)
{
$musicArr[] = $musicItem;
}

if($j%5 == 0)
{
$musicArr[] = $musicItem;
$musicItem = "";
$j = "1";
}
}
}
else
{
echo "
连接数据库出错!














总共有歌曲<{$total}>








<{section name=secF loop=$musicArr}>

<{section name=secS loop=$musicArr[secF]}>

<{/section}>

<{/section}>

<{$musicArr[secF][secS].name}>《<{$musicArr[secF][secS].songer}>》
 









更简单的方法:
代码:


<{section name=mydata loop=$news}>

<{if $smarty.section.mydata.rownum is div by 3}>


<{/if}>
<{/section}>


<{$news[mydata].news_title}>



最新评论

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 03:20 , Processed in 0.154768 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

返回顶部