您好,欢迎访问一九零五行业门户网

论坛里有人熟悉discuz X3.1吗?怎样将主题内容完整的显示出来

论坛里有人熟悉discuz x3.1吗?怎样将主题内容完整的显示出来。
主题容易读出来forum_thread表就行了,但容易表forum_post里的内容不容易读出来呀。
毕竟里面含有[attach]4[/attach][img=500,666]http://pic.qiushibaike.com/system/pictures/5726/57264521/medium/app57264521.jpg[/img]
等,杂七杂八的数据。
人家官方不交流代码,只交流怎样安装。我晕倒了。只能想到csdn来了,看看有人能不能搞定这个。
回复讨论(解决方案)
论坛里有人熟悉discuz x3.1吗?怎样将主题内容完整的显示出来。
主题容易读出来forum_thread表就行了,但容易表forum_post里的内容不容易读出来呀。
毕竟里面含有[attach]4[/attach][img=500,666]http://pic.qiushibaike.com/system/pictures/5726/57264521/medium/app57264521.jpg[/img]
等,杂七杂八的数据。
人家官方不交流代码,只交流怎样安装。我晕倒了。只能想到csdn来了,看看有人能不能搞定这个。
人家的代码本身就含有一个这样的转换函数 @chinmo 版主
关键是我找到discuzcode()、parseattach()解析函数后,似乎没用。目前还在找原因。
@chinmo 版主
关键是我找到discuzcode()、parseattach()解析函数后,似乎没用。目前还在找原因。
晕死,你直接到他的帖子内容页去找不就知道他用的什么函数了?这还纠结什么 @chinmo
大版主呀,帖子内容应该是source\module\forum\forum_viewthread.php这个文件
可我找来找去,感觉就只有这两个函数相关。但还没有起到作用。
找了两天,晕死
@chinmo
大版主呀,帖子内容应该是source\module\forum\forum_viewthread.php这个文件
可我找来找去,感觉就只有这两个函数相关。但还没有起到作用。
找了两天,晕死
你再他模板找干嘛,dz的他基本都是用$post这个数组保存数据的,你在他的控制器文件里输出这个数组就知道是哪个字段保存着文章内容了,然后你在在他的控制器里查找他对这个字段所用的处理函数不就可以了
做程序这点最起码的查找能力应该有的吧 @chinmo
大版主呀,我肯定不会去模板层找了,真的没有你想象的那么简单,我用的是discuz x3.1utf8版本。
帖子内容应该是source\module\forum\forum_viewthread.php这个文件
大概903行左右:
parseattach($_g['forum_attachpids'], $_g['forum_attachtags'], $postlist, $skipaids);
用来解析附件的。
大概是在1228行:
        $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $_g['forum']['allowsmilies'], $forum_allowbbcode, ($_g['forum']['allowimgcode'] && $_g['setting']['showimages'] ? 1 : 0), $_g['forum']['allowhtml'], ($_g['forum']['jammer'] && $post['authorid'] != $_g['uid'] ? 1 : 0), 0, $post['authorid'], $_g['cache']['usergroups'][$post['groupid']]['allowmediacode'] && $_g['forum']['allowmediacode'], $post['pid'], $_g['setting']['lazyload'], $post['dbdateline'], $post['first']);
用来解析内容的
但不晓得为什么就是不成功。
discuzcode 就是了用的这个函数
不成功的话
最简单的排查就是在这个函数里断句输出,看看他在那里替换不成功
这样也可以找出你具体是在什么环节上弄错了
各路php牛人,我把代码奉上:
cachelist = $cachelist;
c::app()->init();
//$navtitle = str_replace('{bbname}', $_g['setting']['bbname'], $_g['setting']['seotitle']['forum']);
//$_g['setting']['threadhidethreshold'] = 1;
//$query = c::t('forum_thread')->fetch_all_for_guide1($view, $limittid, $tids, $_g['setting']['heatthread']['guidelimit'], $dateline);
//$query = c::t('forum_thread')->fetch_all_search('', 'forum_thread', 0,'', '', '');;
//print_r($query);
require_once libfile('function/discuzcode');
require_once libfile('function/attachment');
require_once libfile('function/forum');
   $sql = select a.*, b.message,b.htmlon,b.bbcodeoff,b.smileyoff,b.parseurloff,b.pid,b.first from .db::table('forum_thread'). a left join .db::table('forum_post'). b on a.authorid=b.authorid and a.tid=b.tid and b.first=1  where 1=1 and a.heats>=1 ;
   $sql = select a.*, b.message,b.htmlon,b.bbcodeoff,b.smileyoff,b.parseurloff,b.pid,b.first from .db::table('forum_thread'). a left join .db::table('forum_post'). b on a.authorid=b.authorid and a.tid=b.tid and b.first=1 where a.tid>0 and a.heats>=0  order by a.lastpost desc limit 600;
  $query = db::fetch_all($sql);
  $postlist     = array();
  foreach($query as $post){
      $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $_g['forum']['allowsmilies'], $forum_allowbbcode, ($_g['forum']['allowimgcode'] && $_g['setting']['showimages'] ? 1 : 0), $_g['forum']['allowhtml'], ($_g['forum']['jammer'] && $post['authorid'] != $_g['uid'] ? 1 : 0), 0, $post['authorid'], $_g['cache']['usergroups'][$post['groupid']]['allowmediacode'] && $_g['forum']['allowmediacode'], $post['pid'], $_g['setting']['lazyload'], $post['dbdateline'], $post['first']);
$_g['forum_attachpids'][] = $post['pid'];
      if(preg_match_all(/\[attach\](\d+)\[\/attach\]/i, $post['message'], $matchaids)) {
   $_g['forum_attachtags'][$post['pid']] = $matchaids[1];
      }
      $postlist[$post['pid']] = $post;
  }
parseattach($_g['forum_attachpids'], $_g['forum_attachtags'], $postlist);
print_r($postlist);
?>
死活找不到那里有问题。
形如[img=500,666]http://pic.qiushibaike.com/system/pictures/5726/57264521/medium/app57264521.jpg[/img]
这样的是 ubb 代码
你可以找到 ubb 解码程序相关的部分切入
他好像是 bbcode 类
我也是跟lz一样,找到类似函数后没法解析了。这里看来大神没空解释这个问题
其它类似信息

推荐信息