亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

開發(fā)范例:顯示最新10條新聞

顯示最新10條新聞程序編寫例子 程序代碼編寫 存放目錄格式:
插件程序存放目錄用: /e/extend/newnews/
插件程序模板存放目錄用: /e/extend/newnews/template/
所需程序文件:
/e/extend/newnews/index.php 主程序文件
/e/extend/newnews/template/index.temp.php 主程序模板文件

程序目錄 模板目錄
    主程序文件內(nèi)容(/e/extend/newnews/index.php):
<?php
require('../../class/connect.php'); //引入數(shù)據(jù)庫配置文件和公共函數(shù)文件
require('../../class/db_sql.php'); //引入數(shù)據(jù)庫操作文件
require('../../data/dbcache/class.php'); //引入欄目緩存文件
$link=db_connect(); //連接MYSQL
$empire=new mysqlquery(); //聲明數(shù)據(jù)庫操作類
$editor=1; //聲明目錄層次

$sql=$empire->query("select * from {$dbtbpre}ecms_news order by newstime limit 10"); //查詢新聞表最新10條記錄
require('template/index.temp.php'); //導(dǎo)入模板文件

db_close(); //關(guān)閉MYSQL鏈接
$empire=null; //注消操作類變量
?>


主程序模板文件內(nèi)容(/e/extend/newnews/template/index.temp.php):
<?php
if(!defined('InEmpireCMS'))
{
        exit();
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>顯示最新10條新聞例子</title>
</head>
<body>
<br>
<br>
<br>
<table width="500" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
    <td height="25"><strong>顯示最新10條新聞:</strong></td>
  </tr>
  <tr>
    <td height="25" bgcolor="#FFFFFF">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <?php
                while($r=$empire->fetch($sql))        //循環(huán)獲取查詢記錄
                {
                        $titleurl=sys_ReturnBqTitleLink($r);        //標(biāo)題鏈接
                ?>
                <tr>
                <td width="67%" height="25">·<a href="<?=$titleurl?>" target="_blank">
                <?=esub(stripslashes($r[title]),32)?>
                </a></td>
                <td width="33%"><div align="center">[<?=date('Y-m-d',$r[newstime])?>]</div></td>
                </tr>
                <?php
                }
                ?>
                </table>

    </td>
  </tr>
</table>
</body>
</html>
說明:模板可用Dreamweaver可視化制作。其中藍色部分代碼為不允許直接訪問模板文件的作用。   訪問Hello World插件文件主程序:/e/extend/newnews/index.php