discuz 后台设置不同版块使用不同模板 [复制链接]

moqu8 2018-6-15

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

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

操作:

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

ffile,主题列表模板
vfile,主题内容模板
手动添加或执行
  1. ALTER TABLE `pre_forum_forum` ADD `ffile` CHAR( 40 ) NOT NULL AFTER `styleid` , ADD `vfile` CHAR( 40 ) NOT NULL AFTER `ffile`;
复制代码

2.添加后台表单


打开source/admincp/admincp_forums.php,找到
  1. showsetting('forums_edit_extend_threadcache', 'threadcachesnew', $forum['threadcaches'], 'text');
复制代码
其下添加
  1. showsetting('forums_edit_extend_ffile', 'ffilenew', $forum['ffile'], 'text');
  2. showsetting('forums_edit_extend_vfile', 'vfilenew', $forum['vfile'], 'text');
复制代码
找到
  1. 'styleid' => $_GET['styleidnew']
复制代码
其下添加
  1. 'ffile'=>$_GET['ffilenew'],
  2. 'vfile'=>$_GET['vfilenew'],
复制代码

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

打开source/module/forum/forum_forumdisplay.php,找到
  1. include template($template);
复制代码
注释掉,其下添加
  1. if($_G['forum']['ffile'])
  2. $skinfile=$_G['forum']['ffile'];
  3. else
  4. $skinfile = $template;
  5. include template($skinfile);
复制代码

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

打开source/module/forum/forum_viewthread.php,找到
  1. include template('diy:forum/viewthread'.$sufix.':'.$_G['fid']);
复制代码
注释掉,其下添加
  1. if($_G['forum']['vfile']){
  2. include template($_G['forum']['vfile']);
  3. }
  4. else{
  5. include template('diy:forum/viewthread'.$sufix.':'.$_G['fid']);
  6. }
复制代码
5.给后台表单添加名称和说明
打开source/language/lang_admincp.php,找到
  1. forums_edit_extend_threadcache_comment
复制代码
其下添加
  1. 'forums_edit_extend_ffile' => '主题列表模板文件:',
  2. 'forums_edit_extend_ffile_comment' => '填写格式如forum/forumdisplay,为空则默认为forumdisplay',
  3. 'forums_edit_extend_vfile' => '版块内容模板文件:',
  4. 'forums_edit_extend_vfile_comment' => '填写格式如forum/viewthread,为空则默认为viewthread',
复制代码
至此修改完成。

打开后台,版块编辑,扩展设置,页面缓存系数之下有新增的表单,按说明填写即可。
最新回复 (0)
返回
支持中心
邮箱:winkill2012@qqcom
新站优化中!部分功能尚未完善,敬请谅解!
支持中心