入口页面
<?php /** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: sample.php 24842 2011-10-12 09:51:37Z zhengqingpeng $ */ define('APPTYPEID', 2140); define('CURSCRIPT', 'sample'); require './source/class/class_core.php'; $discuz = C::app(); $modarray = array('mod1','mod2','mod3','mod4'); $mod = !in_array($discuz->var['mod'], $modarray) ? 'mod1' : $discuz->var['mod']; $discuz->init(); define('CURMODULE', $mod); runhooks(); require DISCUZ_ROOT.'./source/module/'.CURSCRIPT.'/'.$mod.'.php'; ?>
mod页面
<?php /** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: mod.php 2011/8/10 15:31 fuqingrong $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $actionarray = array('ac1','ac2'); $action = getgpc('ac'); $action = in_array($action,$actionarray) ? $action : 'ac1'; if($action == 'ac1'){ //some code.... }elseif($action == 'ac2'){ //some code.... } include template('diy:'.CURSCRIPT.'/'.$mod.'_'.$action); ?>