機密情報ページングリストプログラム作成例


カテゴリ情報ページングリストプログラム記述例 プログラムコードの作成 ストレージ ディレクトリの形式:
プラグインプログラム格納ディレクトリ: /e/extend/infolist/
プラグイン テンプレートの保存ディレクトリは次を使用します: /e/extend/infolist/template/
必要なプログラム ファイル:
/e/extend/infolist/index.php メインプログラムファイル
/e/extend/infolist/template/index.temp.php メインプログラムテンプレートファイル

プログラムディレクトリ テンプレートディレクトリ
メイン プログラム ファイルの内容 (/e/extend/infolist/index.php):

<?php
require('../../class/connect.php'); //データベース設定ファイルとパブリック関数ファイルを導入します
require('../../class/db_sql.php'); //データベース操作ファイルの導入
require('../../data/dbcache/class.php'); //列キャッシュ ファイルを導入します
require '../'.LoadLang("pub/fun.php"); //ページング言語パック ファイルを導入します
$link=db_connect(); //MYSQL
に接続します $empire=new mysqlquery(); //データベース操作クラスを宣言します
$editor=1; //ディレクトリ階層を宣言

//--------ページングパラメータ --------
$page=(int)$_GET['ページ'];
$start=0;
$line=10; //ページあたりのレコード数を表示
$page_line=8; //ページごとのページング リンクの数を表示します
$offset=$page*$line; //合計オフセット

//-------- クエリ SQL --------
//情報の総数を取得
$totalquery="{$dbtbpre}ecms_info から合計として count(*) を選択してください チェックした場所=1";
$num=$empire->gettotal($totalquery);
//クエリSQL
を選択 $query="select * from {$dbtbpre}ecms_info where selected=1";
$query.=" ニュースタイムの説明制限による順序 $offset,$line";
$sql=$empire->クエリ($クエリ);

$listpage=page1($num,$line,$page_line,$start,$page,$search);//ページング ナビゲーションを取得します
require('template/index.temp.php'); //テンプレートファイルをインポート

db_close(); //MYSQL リンクを閉じる
$empire=null; //キャンセル操作クラス変数
?>


メイン プログラム テンプレート ファイルの内容(/e/extend/infolist/template/index.temp.php):
注: テンプレートは Dreamweaver を使用して視覚的に作成できます。コードの青色の部分では、テンプレート ファイルへの直接アクセスが許可されていません。
<?php
if(!define('InEmpireCMS'))
{
出口();### }
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content- Type" content="text/html; charset=gb2312">
<title>分类情報分页列表</title>
<link href="template/images/style.css" rel= "stylesheet" type="text/css">
</head>
<body>
<br>
<br>
<br>
<table width="500" border="0" align="center" cellpadding="3" cellpacing="1" bgcolor="#CCCCCC">
<tr>
<td height="25"><strong>分类情報分页列表:</strong></td>
</tr>
<tr>
<td height="25" bgcolor="#FFFFFF">
<テーブル width="100%" border="0" cellpacing="0" cellpadding="0">
<?php
while($r=$empire->fetch($sql)) //循環获取查询记录
{
$titleurl=sys_ReturnBqTitleLink($r); //标题链接
?>
<tr>
<td width="74%" 高さ="25">
<img src="template/images/arrow.gif" border="0" align="absmiddle"> [<a href="<?=$public_r[newsurl]?>e/action/ListInfo.php?classid=<?=$r[classid]?> &ph=1&myarea=<?=$r[myarea]?>"><?=$r[myarea]?></a>] <a href="<?=$titleurl?>" target="_blank">
<?=esub(ストリップスラッシュ($r[タイトル]),32)?>
</a></td>
<td width="26%"><div align="センター">
&lt;?= date( 'y-m-d'、$ r [newstime])?&gt;
                                                                                                                                                                                                                          }
?>
                                                               
</td>
</tr>
<tr>
<td height="30" bgcolor="#FFFFFF">
<div class="epages" >

<?=$listpage?>

</div></td>
</tr></table></body>
</html>



Hello World プラグイン ファイルのメイン プログラムにアクセスします: /e/extend/newnews/index.php