開発例:「Hello, world」を表示


「Hello, world」プログラミング例を表示します プログラムコードの作成 ストレージ ディレクトリの形式:
プラグインプログラム格納ディレクトリ: /e/extend/helloworld/
プラグイン テンプレートの保存ディレクトリは次を使用します: /e/extend/helloworld/template/
必要なプログラム ファイル:
/e/extend/helloworld/index.php メインプログラムファイル
/e/extend/helloworld/template/index.temp.php メインプログラムテンプレートファイル

プログラムディレクトリ テンプレートディレクトリ
メイン プログラム ファイルの内容 (/e/extend/helloworld/index.php):
<?php
require('../../class/connect.php'); //データベース設定ファイルとパブリック関数ファイルを導入します
require('../../class/db_sql.php'); //データベース操作ファイルの導入
$link=db_connect(); //MYSQL
に接続します $empire=new mysqlquery(); //データベース操作クラスを宣言します
$editor=1; //ディレクトリ階層を宣言

$context='Hello, World!'; //表示内容を定義
require('template/index.temp.php'); //テンプレートファイルをインポート

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


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



<title>表示<?=$context?>例</title>
</head>
<body>
<br>
<br>
<br>
<表 width="500" border="0" align="center" cellpadding="3" cellpacing="1" bgcolor="#CCCCCC">
<tr>
</tr>
<tr>
<td height="60" bgcolor="#FFFFFF"> <div align="center"><strong><font color="#FF0000" size="5"><?=$context?></font></strong></div></td>
</tr>
</table>
</body>
</html>

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