本學習過程涉及到入口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}-->