限时优惠
查看: 963|回复: 0

discuz后台设置不同版块使用不同模板

[复制链接]
发表于 2019-3-18 13:33:52 | 显示全部楼层 |阅读模式

本功能不是选择“风格方案”,一个风格就够了。

!实现此功能需要动数据库。

操作:

1.为表pre_forum_forum添加两个字段:

ffile,主题列表模板
vfile,主题内容模板
手动添加或执行


  • ALTER TABLE `pre_forum_forum` ADD `ffile` CHAR( 40 ) NOT NULL AFTER `styleid` , ADD `vfile` CHAR( 40 ) NOT NULL AFTER `ffile`;

[color=#336699 !important]复制代码

2.添加后台表单


打开source/admincp/admincp_forums.php,找到

  • showsetting('forums_edit_extend_threadcache', 'threadcachesnew', $forum['threadcaches'], 'text');

[color=#336699 !important]复制代码
其下添加

  • showsetting('forums_edit_extend_ffile', 'ffilenew', $forum['ffile'], 'text');
  • showsetting('forums_edit_extend_vfile', 'vfilenew', $forum['vfile'], 'text');

[color=#336699 !important]复制代码
找到

  • 'styleid' => $_GET['styleidnew']

[color=#336699 !important]复制代码
其下添加

  • 'ffile'=>$_GET['ffilenew'],
  • 'vfile'=>$_GET['vfilenew'],

[color=#336699 !important]复制代码

3.给主题列表模板增加判断

打开source/module/forum/forum_forumdisplay.php,找到

  • include template($template);

[color=#336699 !important]复制代码
注释掉,其下添加

  • if($_G['forum']['ffile'])
  • $skinfile=$_G['forum']['ffile'];
  • else
  • $skinfile = $template;
  • include template($skinfile);

[color=#336699 !important]复制代码

4.给主题内容模板增加判断

打开source/module/forum/forum_viewthread.php,找到

  • include template('diy:forum/viewthread'.$sufix.':'.$_G['fid']);

[color=#336699 !important]复制代码
注释掉,其下添加

  • if($_G['forum']['vfile']){
  • include template($_G['forum']['vfile']);
  • }
  • else{
  • include template('diy:forum/viewthread'.$sufix.':'.$_G['fid']);
  • }

[color=#336699 !important]复制代码
5.给后台表单添加名称和说明
打开source/language/lang_admincp.php,找到

  • forums_edit_extend_threadcache_comment

[color=#336699 !important]复制代码
其下添加

  • 'forums_edit_extend_ffile' => '主题列表模板文件:',
  • 'forums_edit_extend_ffile_comment' => '填写格式如forum/forumdisplay,为空则默认为forumdisplay',
  • 'forums_edit_extend_vfile' => '版块内容模板文件:',
  • 'forums_edit_extend_vfile_comment' => '填写格式如forum/viewthread,为空则默认为viewthread',

[color=#336699 !important]复制代码
至此修改完成。

打开后台,版块编辑,扩展设置,页面缓存系数之下有新增的表单,按说明填写即可。

谁来看过此贴
此贴被TA们浏览了963次
回复

使用道具 举报

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

本版积分规则

扫一扫下载app
关注我们,扫描左边二维码,下载APP更好的体验,你还在等什么?
快速回复 返回顶部 返回列表