本文特别鸣谢建站笔记http://www.cmsbj.cn/dzdm/t945.html大佬帮助,为方便以后使用,特此记录下来.
为了解决这个问题,小编几乎百度了几十页的内容,折腾几天最终是建站笔记大佬给帮助下解决了!再次感谢!
本功能不是选择“风格方案”,一个风格就够了。
!实现此功能需要动数据库。
操作:
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`;
2.添加后台表单 打开source/admincp/admincp_forums.php,找到
showsetting('forums_edit_extend_threadcache', 'threadcachesnew', $forum['threadcaches'], 'text');
其下添加
showsetting('forums_edit_extend_ffile', 'ffilenew', $forum['ffile'], 'text'); showsetting('forums_edit_extend_vfile', 'vfilenew', $forum['vfile'], 'text');
找到
'styleid' => $_GET['styleidnew']
其下添加
'ffile'=>$_GET['ffilenew'], 'vfile'=>$_GET['vfilenew'],
3.给主题列表模板增加判断
打开source/module/forum/forum_forumdisplay.php,
找到
$template = 'diy:forum/forumdisplay:'.$_G['fid'];
在其下增加:
$template2 = 'diy:'.$_G['forum']['ffile'].':'.$_G['fid'];
再找到
include template($template);
注释掉,其下添加
if($_G['forum']['ffile'])
$skinfile=$template2;
else
$skinfile = $template;
include template($skinfile);
4.给主题内容模板增加判断
打开source/module/forum/forum_viewthread.php,
找到
include template('diy:forum/viewthread'.$sufix.':'.$_G['fid']);
注释掉,其下添加
if($_G['forum']['vfile']){ include template($_G['forum']['vfile']); } else{ include template('diy:forum/viewthread'.$sufix.':'.$_G['fid']); }
5.给后台表单添加名称和说明
打开source/language/lang_admincp.php,
找到
forums_edit_extend_threadcache_comment
其下添加
'forums_edit_extend_ffile' => '主题列表模板文件:', 'forums_edit_extend_ffile_comment' => '填写格式如forum/forumdisplay,为空则默认为forumdisplay',
'forums_edit_extend_vfile' => '版块内容模板文件:', 'forums_edit_extend_vfile_comment' => '填写格式如forum/viewthread,为空则默认为viewthread',
至此修改完成。
打开后台,版块编辑,扩展设置,页面缓存系数之下有新增的表单,按说明填写即可。
小贴士:业余选手不要去琢磨怎么调用指定风格的头部底部,费尽千辛万苦实现过。看似用的是同一个,但还是会出现找不到文件或变量或js的情况存在,这是错误的研究方向。