discuz 自定義不同欄目不同模板

2021-09-13 11:20:28 字數 1968 閱讀 3998

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']) else
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的情況存在,這是錯誤的研究方向。

DISCUZ 自定義模板

discuz 自定義模板 模板安裝和維護 安裝新模板 將模板template打包放在對應目錄 template 後台 介面 風格管理 安裝模板 後台 介面 風格管理 切換模板 開啟頁面,使用admin賬號匯入頁面模板diy的xml配置檔案 重新安裝模板 刪除模板 後台 介面 模板管理 解除安裝模板 ...

WordPress自定義欄目使用教程

wordpress自定義欄目 字段 是對wordpress文章屬性一種拓展,一般寫文章的時候,後台文章編輯只提供了文章的分類 作者 標籤 時間等屬性。而自定義欄目可以增加文章其它屬性,例如 點讚數和瀏覽量。而這些屬性欄位和值都會儲存在wp資料庫裡面。現在很多wordpress主題或外掛程式都會使用自...

自定義tabs切換顯示不同內容 Vue

使用方法 1 傳入內容為標題的title陣列 2 向外傳遞了乙個currentindex的方法,引數就是當前選中標題的索引 根據索引展示不同內容 示例 tab tab tit for item,index in title key index class currentindex index?on ...