|
本学习过程涉及到入口php文件、控制php文件、模板html文件的最基本内容。最终仅显示模板文件的内容。未涉及任何数据库及变量。这个学习过程可以说什么也没干,只是验证了一下动作流程。
目录及文件:
- /gycp.php
- /source/module/gycp/gycp_publish.php
- /template/default/gycp/gycp_publish.htm
复制代码
入口文件 /gycp.php:
- <?php
-
- /**
- * [Discuz!] (C)2001-2099 Comsenz Inc.
- * This is NOT a freeware, use is subject to license terms
- *
- * $Id: gycp.php cuibq $
- */
-
-
- define('APPTYPEID', 101);
- define('CURSCRIPT', 'gycp');
-
- require './source/class/class_core.php';
-
- $discuz = C::app();
-
- $discuz->reject_robot();
- $modarray = array('gycp', 'gycp_publish');
-
-
- $mod = getgpc('mod');
- $mod = (empty($mod) || !in_array($mod, $modarray)) ? 'error' : $mod;
-
-
- $discuz->init();
-
- define('CURMODULE', $mod);
-
-
- require DISCUZ_ROOT.'./source/module/gycp/gycp_publish.php';
-
- ?>
复制代码
控制文件 /source/module/gycp/gycp_publish.php
- <?php
- // mod文件只能被入口文件引用,不能直接访问
- if(!defined('IN_DISCUZ')) {
- exit('Access Denied');
- }
-
-
-
- //显示发布表单
- include_once template("gycp/gycp_publish");
- ?>
复制代码
模板文件 /template/default/gycp/gycp_publish.htm
- <!--//说明: 显示公共头部模板-->
- <!--{template common/header}-->
-
- <br/>
- <br/>
- <br/>
- <br/>
- aaa
- <br/>
- <br/>
- <br/>
- <br/>
-
- <!--//说明: 显示公共尾部模板-->
- <!--{template common/footer}-->
复制代码
|
|