开发范例:显示“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):
if(!define('InEmpireCMS'))
{
        退出();
}
?>





显示<?=$context?>示例

<身体>
<br>
<br>
<br>
<桌子 宽度=“500”边框=“0”对齐=“中心” cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
    <td height="25"><strong>显示内容如下:</strong></td>
  </tr>
  <tr>
   
<强><字体颜色=“#FF0000” size="5"><?=$context?></font></strong></div></td>
  </tr>
</table>
</body>
</html>
说明:模板可用Dreamweaver可视化制作。其中蓝色部分代码为不允许直接访问模板文件的作用。   访问Hello World插件文件主程序:/e/extend/helloworld/index.php