Discuz教程网

Discuz X3.0将模块化发表主题功能

[复制链接]
authicon dly 发表于 2012-8-24 21:35:05 | 显示全部楼层 |阅读模式
模块化发表主题功能发表主题的方法只实现最简单的普通主题的发表功能,其它主题功能如特殊主题、抢楼帖、分类信息等均以扩展方式实现3 D9 具体实现方法是:给model_forum_thread->newthread()方法的执行前后绑定相应的扩展方法,部分代码如下:
        

  1. $modthread = C::m('forum_thread');
  2.         $bfmethods = $afmethods = array();//note 抢楼贴
  3. }
  4.         if($_GET['rushreply']) {                $bfmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'before_newthread');
  5.                 $afmethods[] = array('class' => 'extend_thread_rushreply', 'method' => 'after_newthread');
  6.        }
  7. {        //noteX 回帖送积分(不使用标志位)
  8.         $bfmethods[] = array('class' => 'extend_thread_replycredit', 'method' => 'before_newthread');
  9.         $afmethods[] = array('class' => 'extend_thread_replycredit', 'method' => 'after_newthread');
  10.        if($sortid) {
  11.                $bfmethods[] = array('class' => 'extend_thread_sort', 'method' => 'before_newthread');
  12. }                $afmethods[] = array('class' => 'extend_thread_sort', 'method' => 'after_newthread');
  13.         }
  14.         $bfmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'before_newthread');
  15.         $afmethods[] = array('class' => 'extend_thread_allowat', 'method' => 'after_newthread');
  16.         $afmethods[] = array('class' => 'extend_thread_image', 'method' => 'after_newthread');
  17.         if(!empty($_GET['adddynamic'])) {
  18.                 $afmethods[] = array('class' => 'extend_thread_follow', 'method' => 'after_newthread');
  19.        }
  20.        $modthread->attach_before_methods('newthread', $bfmethods);
  21.         $modthread->attach_after_methods('newthread', $afmethods);
复制代码




上一篇:Discuz X3.0将模块化发表回帖功能
下一篇:Discuz X3.0将增加主题、文章、日志的防采集功能
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 18:53

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表