Ecmsphp开发中心

1252

帖子

19

跟帖

8

粉丝

用户组:普通会员

头    衔:白银会员

版主

积分
356930
登陆
2134 次
私信
注册时间
2014-06-21 14:06:06
最后登陆时间
2023-09-24 16:04:46

帝国CMS教程:显示“Hello,world”插件二次开发方法

 [只看主题]
楼主
0 |
发表: 3 年前
| |
| |
跳转

帝国cms插件二次开发显示“Hello,world”如何设置,是教大家怎么设置帝国cms插件二次开发显示“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):


<?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>显示<?=$context?>例子</title>

</head>

<body>

<br>

<br>

<br>

<table width="500" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">

  <tr>

    <td height="25"><strong>显示内容为如下:</strong></td>

  </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

以上是插件二次开发显示“Hello,world”的方法。

ecmsphp开发中心
ecmsphp开发中心
验证码 换一个

当前在线人数: 0
取消

感谢您的支持,我们会继续努力!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

×

打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮

帝国CMS教程:显示“Hello,world”插件二次开发方法