很多站長希望在DIY的時候調(diào)用主題標簽TAG,Discuz!默認是不支持調(diào)用TAG的,本文介紹如何修改DIY源碼實現(xiàn)我們所需要的功能: 修改文件:source/class/block/forum/block_thread.php 搜索 [php] view plain copy 'todayposts' => array('name' => lang('blockclass', 'blockclass_thread_field_todayposts'), 'formtype' => 'text', 'datatype' => 'int'), 在下方添加 [php] view plain copy 'keywords' => array('name' => "主題標簽", 'formtype' => 'text', 'datatype' => 'string'), 再搜索 [php] view plain copy if($style['getsummary']) { $threadtids[$data['posttableid']][] = $data['tid']; } 再下方添加 [php] view plain copy $tags = DB::result_first("select tags from ".DB::table("forum_post")." where first=1 and tid=".$data['tid']); $tags = explode("/t",$tags); $keywords = ''; foreach($tags as $tag){ $array = explode(",",$tag); if($array[1]) $keywords .= '<a title="'.$array[1].'" href="misc.php?mod=tag&id='.$array[0].'" target="_blank">'.$array[1].'</a>,'; } $keywords = substr($keywords,0,-1); 這里添加的樣式是帶有鏈接的,如果不加鏈接,可以改成: [php] view plain copy $tags = DB::result_first("select tags from ".DB::table("forum_post")." where first=1 and tid=".$data['tid']); $tags = explode("/t",$tags); $keywords = ''; foreach($tags as $tag){ $array = explode(",",$tag); if($array[1]) $keywords .= $array[1].','; } $keywords = substr($keywords,0,-1); 再搜索 [php] view plain copy 'fields' => array( 在下方添加 [php] view plain copy 'keywords' => $keywords, 后臺,工具,更新DIY模塊緩存,然后正常使用帖子模塊即可發(fā)現(xiàn)可以使用{keywords}調(diào)用主題標簽了