Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[展示] 自定义模块开发

[复制链接]
dreamboycx 发表于 2016-10-31 17:16:20 | 显示全部楼层 |阅读模式
本帖最后由 dreamboycx 于 2016-10-31 17:20 编辑

discuz的自定义模块开发必须是要用插件开发机制吗?比如我能不能这样,复制一份portal.php文件,改名为test.php,把里面的内容改改,然后在default目录下创建一个test文件夹,把portal模板文件夹下的index.html复制出来一份放里面,这样直接出来一个新的php文件,这样为什么不行呢?我这么做时,页面空白,连discuz默认的header都不出来,是哪里出错了?还是不能允许这么做呢?请教下

test.php

  1. <?php

  2. /**
  3. *      [Discuz!] (C)2001-2099 Comsenz Inc.
  4. *      This is NOT a freeware, use is subject to license terms
  5. *
  6. *      $Id: portal.php 33234 2013-05-08 04:13:19Z andyzheng $
  7. */

  8. define('APPTYPEID', 14);
  9. define('CURSCRIPT', 'test');

  10. require './source/class/class_core.php';
  11. $discuz = C::app();

  12. $cachelist = array('userapp', 'portalcategory', 'diytemplatenameportal');
  13. $discuz->cachelist = $cachelist;
  14. $discuz->init();

  15. require DISCUZ_ROOT.'./source/function/function_home.php';
  16. require DISCUZ_ROOT.'./source/function/function_portal.php';

  17. if(empty($_GET['mod']) || !in_array($_GET['mod'], array('list', 'view', 'comment', 'portalcp', 'topic', 'attachment', 'rss', 'block'))) $_GET['mod'] = 'index';


  18. define('CURMODULE', $_GET['mod']);
  19. runhooks();

  20. //$navtitle = str_replace('{bbname}', $_G['setting']['bbname'], $_G['setting']['seotitle']['portal']);
  21. $_G['disabledwidthauto'] = 1;
  22. require_once libfile('test/'.$_GET['mod'], 'module');

  23. ?>
复制代码



default下的test/index.html
  1. <!--{template common/header}-->
  2. <style id="diy_style" type="text/css"></style>
  3. <div class="wp">
  4.         <!--[diy=diy1]--><div id="diy1" class="area"></div><!--[/diy]-->
  5. </div>
  6. <script src="misc.php?mod=diyhelp&action=get&type=index&diy=yes&r={echo random(4)}" type="text/javascript"></script>
  7. <!--{template common/footer}-->
复制代码

Tardis.Labs 发表于 2016-11-2 19:43:03 | 显示全部楼层
https://discuz.dismall.com/thread-1832228-1-1.html
直接看这个单页制作教程吧
回复

使用道具 举报

 楼主| dreamboycx 发表于 2016-11-2 20:03:16 | 显示全部楼层
Tardis.Labs 发表于 2016-11-2 19:43
https://discuz.dismall.com/thread-1832228-1-1.html
直接看这个单页制作教程吧

谢谢。。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-19 11:59 , Processed in 0.115368 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表