• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

adodb+smarty+myClass 结合:数据类的智_php

php 搞代码 7年前 (2018-06-21) 113次浏览 已收录 0个评论
<?php
/**
*
* @author 风卷残云, <bighuang at 126 dot com>
* @copyright Copyright (c) 闲情网站, 2004-2005
* @since ~

http://www.gaodaima.com/48089.htmladodb+smarty+myClass 结合:数据类的智_php

*/
/*+++++++++++++++++++++++++
* Copyright (c) 2004,闲情网站
* All rights reserved
*
* 系统名称:闲情音乐
* 文件名称:diary.php
* 文件标识:见配置管理计划书
* 功        能:
* 摘        要:
*
* 当前版本:1.0
* 作        者:风卷残云
* 作者主页:http://freeday.512j.com
* 作者邮箱:[email protected]
* 作者   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[$j1][name] = $n[MC_name
];
        
$musicItem[$j1][songer] = $n[MC_songer
];
        
$musicItem[$j1][url] = $n[MC_url
];
        
$j
++;
        

        
        if($i==$total && $j%5!=0
)
        {
            
$musicArr[] = $musicItem
;
        }
            
        if(
$j%5 == 0
)
        {
            
$musicArr[] = $musicItem
;
            
$musicItem = “”
;
            
$j = “1”
;
        }
    }
}
else
{
echo
“<tr><td  align=center >连接数据库出错!</td></tr>”
;
}

$smarty->assign(‘total’,$total);

$smarty->assign(‘musicArr’,$musicArr);

$my->close();
$smarty->display(‘music.htm’
);
require(
“include/footer.php”
);
exit();
?>

 
 
music.htm
<table class=“toutm” width=“768”  align=“center”  cellpadding=“0” cellspacing=“0”
  <
tr

    <
td height=“25” class=“tdbc”>总共有歌曲<font color=“#FF0000”><{$total}></font>   
    </td
  </
tr

  <
tr
>
    <
td width=“768” class=“line”>
    </td>
  </
tr
>

  <tr>
    <
td
>  
      <
table>

        <tr>
          <td>
            <table>
              <{
section name=secF loop=$musicArr
}>
              <
tr
>
                   <{
section name=secS loop=$musicArr[secF
]}> 
                  <
td
>
                       <
IMG  src=“images/11.gif” width=12><A title=“” onclick=“window.open(this.href,”,’top=0,left=0,width=550,height=370,scrollbars=yes,resizable=no’);return false;”  href=http://freeday.512j.com/old/wj/sp.php?path=&lt;{$musicArr[secF][secS].url}>” target=_blank><{$musicArr[secF][secS].name}><{$musicArr[secF][secS].songer}></A
>
               
 </td>
                  <{/section}>
               </tr>
               <{/
section
}> 
             </
table>
           </td>
         </tr>
       </table
     </
td

   </
tr

   <
tr

      <
td width=“768”  class=“line”></td

    </
tr
>
</
table>
 
 
 
 
 
 
更简单的方法:

代码:

<table border="1" width="599" cellpadding="0" cellspacing="0" align="center">
    <
tr>
    <{
section name=mydata loop=$news}>
        <
td width="69%" align="center">
            <
a href="#?id=<{$news[mydata].news_id}>"><{$news[mydata].news_title}></a>
        </
td>
    <{if
$smarty.section.mydata.rownum is div by 3}>
    </
tr>
    <
tr>
    <{/if}>
    <{/
section}>
    </
tr>
</
table>

欢迎大家阅读《adodb+smarty+myClass 结合:数据类的智_php》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:adodb+smarty+myClass 结合:数据类的智_php

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址