本帖最后由 dreamboycx 于 2016-10-31 17:20 编辑
discuz的自定义模块开发必须是要用插件开发机制吗?比如我能不能这样,复制一份portal.php文件,改名为test.php,把里面的内容改改,然后在default目录下创建一个test文件夹,把portal模板文件夹下的index.html复制出来一份放里面,这样直接出来一个新的php文件,这样为什么不行呢?我这么做时,页面空白,连discuz默认的header都不出来,是哪里出错了?还是不能允许这么做呢?请教下
test.php
- <?php
- /**
- * [Discuz!] (C)2001-2099 Comsenz Inc.
- * This is NOT a freeware, use is subject to license terms
- *
- * $Id: portal.php 33234 2013-05-08 04:13:19Z andyzheng $
- */
- define('APPTYPEID', 14);
- define('CURSCRIPT', 'test');
- require './source/class/class_core.php';
- $discuz = C::app();
- $cachelist = array('userapp', 'portalcategory', 'diytemplatenameportal');
- $discuz->cachelist = $cachelist;
- $discuz->init();
- require DISCUZ_ROOT.'./source/function/function_home.php';
- require DISCUZ_ROOT.'./source/function/function_portal.php';
- if(empty($_GET['mod']) || !in_array($_GET['mod'], array('list', 'view', 'comment', 'portalcp', 'topic', 'attachment', 'rss', 'block'))) $_GET['mod'] = 'index';
- define('CURMODULE', $_GET['mod']);
- runhooks();
- //$navtitle = str_replace('{bbname}', $_G['setting']['bbname'], $_G['setting']['seotitle']['portal']);
- $_G['disabledwidthauto'] = 1;
- require_once libfile('test/'.$_GET['mod'], 'module');
- ?>
复制代码
default下的test/index.html
- <!--{template common/header}-->
- <style id="diy_style" type="text/css"></style>
- <div class="wp">
- <!--[diy=diy1]--><div id="diy1" class="area"></div><!--[/diy]-->
- </div>
- <script src="misc.php?mod=diyhelp&action=get&type=index&diy=yes&r={echo random(4)}" type="text/javascript"></script>
- <!--{template common/footer}-->
复制代码
|