发新帖
打印 上一主题 下一主题
开启左侧边栏

又改进了一些本网的discuz x3.2的程序代码,热帖数据获得问题

  [复制链接]
discuz x3.2 DIY模块中热帖数据的获得有点问题。它只可能按帖子的热度排序后挑选出前几名显示出来。可是我们通常希望,把那些热度值达到我们的最低限后并且是最近活跃(最新回复了的热帖)的帖子显示给读者,像discuz x3.2首页四格中的最新热帖里的结果。按热度排序后选出前几名的结果造成本网的手机版显示出的热帖是那些时间较旧的曾经热帖,而最近正在活跃的但是热度系数暂时还低于过去老帖的热度系数的帖子就不会被选中而被显示出来。我研究了一两天,考虑了几种不同的可能解决方案,都因为对discuz程序设计思想和具体内容不太熟悉,感觉要进行大改动才可能成功。经过仔细分析程序源码,顺藤摸瓜,终于找到问题的关键所在,只在一处改了一个数,另一处添了一行代码,DIY模块中热帖数据的获得结果与首页四格中的一样了。太巧妙了,要给自己鼓掌!这种修改方法显然不是一个好的程序代码设计,只因为discuz程序中的赘余,重复,不一致,小错误的地方,不完美的地方比比皆是,我们在修改它的时候也只好急功近利,能正确显示,且不影响其它的地方就好。

到现在为止,我已经在太多的地方做了小的调整和修改了。太多了,自己也记不住了。开始还试着记录下来改了哪些地方,现在干脆不写笔记了,改就改了。没有那么多时间和耐心做笔记了。

如果想知道更多的本网关于discuz x3.2的改进,也请注意51haoyouadmin的微博,里面有时会提到改进的动态。https://www.51haoyou.com/discuzx3.2/doing-1-me.html


相关帖子




沙发
 楼主| 51haoyouadmin 2016-3-11
discuz x3.2中关于主题热度的参数就是一个没有统一性和唯一性的参数。在后台的主题热度中设置了热门主题显示级别后,仍然有很多问题解决不了。程序中还有很多处要做相应修改,才达到一致。
板凳
 楼主| 51haoyouadmin 2016-3-13

DIY模块中最新热帖数据和最新回复数据的正确获得

DIY模块中最新热帖数据的获得改正后,又改正了DIY模块中最新回复数据的获得,也是只加了一句代码。改正代码即别扭(隐晦),也巧妙。

至此,本网手机触屏版中也获得了与电脑版首页四格中一样的帖子数据列表。最新图片,最新主题,最新回复,最新热帖,最新精华的内容都有了一致的显示。
地板
 楼主| 51haoyouadmin 2016-3-13

discuz 手机版登录和退出时卡死的问题

这两天还新出现了一个以前没有的问题:手机标准版登录时,系统好像死循环了,界面卡死;手机触屏版登出(退出)时,系统报错并卡死。很蹊跷,不知道为什么手机版的FORMHASH出现不一致,而电脑版的没有问题?

最后解决问题的方法:只好加了几行代码强制手机触屏版登出(退出)时转跳到新页面,并不再使用标准版了。实际标准版也没什么用了。
5#
 楼主| 51haoyouadmin 2016-3-19

解决手机分页代码改成伪静态问题及去掉&mobile=2尾巴

终于把手机版的分页代码改造成伪静态显示了。本来都想认输,找不到问题和解决方法了。其实早就基本成功了,上一页和下一页都静态了。就剩下中间的选择转跳页面的地方有个跳不到指定页面的问题。一直以来都是想改进哪,就改了,都没有花太多时间就成了。当然很多解决方案都是通过反复搜索网上的前人经验,很快找到了下手的地方。这次就是一直没有找到出错的地方。有些愚蠢地在$multipage有关的一系列html,php,module,function,class中不断追踪寻找。没有想到手机版的分页功能的最终处理是由JQuery代码处理的。最终还是搜索代码找到地方的。因为电脑版没有问题,手机版有问题的地方有一个“第XX页”的文字标示,这点与电脑显示不同。XX是个变量,我就搜索这个“第”或“页”字(它一定在某个文件里存储着),实际上我搜索的是【第'】,这样就找到了源代码。早就应该这样想嘛!有时人很笨!说好听点,是很大意和想当然。

功夫不负有心人。将来手机版其它的分页功能都类似了。所以全面静态化没有大问题了。

另外,前两天已经把手机版网址后面跟着的小尾巴&mobile=2去掉了。所以静态化后的网址,电脑版的网址和手机版的网址就基本一致和互用了。

最后说一下,分页代码的最后的改进的地方,在文件./static/js/mobile/common.js中
原来是这样的
  $('#dumppage').on('change', function() {
                        var href = (prevpage || nextpage);
                        window.location.href = href.replace(/page=\d+/, 'page=' + $(this).val());

现在改成这样的
  $('#dumppage').on('change', function() {
                        var href = (prevpage || nextpage);
                        if(href.indexOf('html') !=-1){
                        window.location.href = href.substr(0,href.lastIndexOf('-')+1)+ $(this).val()+'.html';
                        }
                        else
                        {
                        window.location.href = href.replace(/page=\d+/, 'page=' + $(this).val());                                   }

6#
 楼主| 51haoyouadmin 2016-3-24
在博客、微博、相册中,已经改进为:默认初始页面都是显示全部所有用户的博客、微博、相册。

使用中肯定有时只想看某一用户的博客、微博、相册。现在在页面里修改增加了一个连结,只要一点击就可以只显示某一用户的户的博客、微博、相册。

这要在下面3个文件里做相应的修改:./template/default/home/space_blog_list.htm,./template/default/home/space_doing.htm,./template/default/home/space_album_list.htm

比如,只要点击 xiaomifeng的微博 就可以只显示xiaomifeng的微博的内容了。





7#
 楼主| 51haoyouadmin 2016-3-28

手机版正确显示外来网站的图片-外链图片

discuz 手机版最大的问题应该是如何正确显示外来网站的图片和视频。不是显示不出来,就是显示尺寸不正确,比例不正确。而且电脑版与手机版的图片正确显示的尺寸不一样,我们希望在电脑版能正确显示后,在手机版也能不必调整源码就正确显示。这两天做了学习和尝试,基本上得到了一个一劳永逸的通用设置。在这种设置下,手机版的论坛和文章里图片的显示都正常了。最重要的的是那些从其它网站的各种网页上拷贝,转贴过来的图片。你不想每次或经常去修改网页源码里设置的图片的显示属性来使图片在本网显示正确。最终我在手机版的common header里添加了下面的内容:
<style type="text/css">body img { max-width: device-width !important; height: auto !important; }</style>
虽然程序设计应该是最一丝不苟和严谨的,但是最终的解决方案,有时确是大胆猜想,和反复尝试出来的。

在几个主要流行的手机流览器的测试结果都一样好。虽然迫使我要对disucz本身网页上的logo等一些图片的显示做调整,那相对是简单的,一次性的修改。

如果上面那个方法不行,本来还有一个下面备用尝试方案。现在就不愿意再试了:

<style type="text/css">
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
body img { max-width: 320px !important; height: auto !important; }
}
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {
body img { max-width: 768px !important; height: auto !important; }
}
</style>

8#
 楼主| 51haoyouadmin 2016-4-3

discuz中钩子hook妨碍你使用插件plugin

discuz中钩子hook妨碍你使用插件plugin

请看discuz官方论坛的一个讨论以了解上面所提出的问题:
谁知道这个插件钩子模板在哪调整?

虽然,我也没有完全搞明白,找到解决办法,但是下面的hook预设列表告诉我们,官方软件里没有在手机版的门户portal里预埋钩子hook。而且我们也有理由怀疑当你使用一个以上的插件的时候,钩子hook就成了头疼的问题。还可以进一步推测,多个插件交互作用的时候,还不仅仅是钩子会引起问题。discuz论坛部分开发的比较彻底了,门户文章方还有很大改进空间,其也是容易产生和发现问题的地方。博客和微博也一样。

所提出的问题,就是一个避免过多使用插件的理由,尤其是第三方开发的插件。所以我们在有可能的情况下有时需要把某些插件消化后融进disucz系统中,不再以插件的形式被使用,可以减少问题,提高效率,减少赘余,易于修改和补充。

我可能要迫不得已考虑消化插件和消灭插件的工作了。

附:discuz系统中的预埋hook钩子列表
./source/admincp/discuzhook.dat
template/default/common/extcredits.htm *<!--{hook/spacecp_credit_extra}-->
template/default/common/faq.htm *<!--{hook/faq_extra}-->
template/default/common/footer.htm *<!--{hook/global_footer}-->
template/default/common/footer.htm *<!--{hook/global_footerlink}-->
template/default/common/header.htm *<!--{hook/global_cpnav_top}-->
template/default/common/header.htm *<!--{hook/global_cpnav_extra1}-->
template/default/common/header.htm *<!--{hook/global_cpnav_extra2}-->
template/default/common/header.htm *<!--{hook/global_myitem_extra}-->
template/default/common/header.htm *<!--{hook/global_nav_extra}-->
template/default/common/header.htm *<!--{hook/global_header}-->
template/default/common/header_qmenu.htm *<!--{hook/global_qmenu_top}-->
template/default/common/header_qmenu.htm *<!--{hook/global_qmenu_bottom}-->
template/default/common/header_userstatus.htm *<!--{hook/global_usernav_extra1}-->
template/default/common/header_userstatus.htm *<!--{hook/global_usernav_extra4}-->
template/default/common/header_userstatus.htm *<!--{hook/global_usernav_extra2}-->
template/default/common/header_userstatus.htm *<!--{hook/global_usernav_extra3}-->
template/default/common/header_userstatus.htm *<!--{hook/global_usernav_extra1}-->
template/default/common/userabout.htm *<!--{hook/global_userabout_top $_G['basescript'].'::'.CURMODULE}-->
template/default/common/userabout.htm *<!--{hook/userapp_menu_top}-->
template/default/common/userabout.htm *<!--{hook/userapp_menu_middle}-->
template/default/common/userabout.htm *<!--{hook/global_userabout_bottom $_G['basescript'].'::'.CURMODULE}-->
template/default/forum/collection_all.htm *<!--{hook/collection_index_top}-->
template/default/forum/collection_all.htm *<!--{hook/collection_index_bottom}-->
template/default/forum/collection_comment.htm *<!--{hook/collection_nav_extra}-->
template/default/forum/collection_index.htm *<!--{hook/collection_index_top}-->
template/default/forum/collection_index.htm *<!--{hook/collection_index_bottom}-->
template/default/forum/collection_mycollection.htm *<!--{hook/collection_index_top}-->
template/default/forum/collection_mycollection.htm *<!--{hook/collection_index_bottom}-->
template/default/forum/collection_nav.htm *<!--{hook/collection_nav_extra}-->
template/default/forum/collection_view.htm *<!--{hook/collection_viewoptions}-->
template/default/forum/collection_view.htm *<!--{hook/collection_view_top}-->
template/default/forum/collection_view.htm *<!--{hook/collection_threadlistbottom}-->
template/default/forum/collection_view.htm *<!--{hook/collection_relatedop}-->
template/default/forum/collection_view.htm *<!--{hook/collection_view_bottom}-->
template/default/forum/collection_view.htm *<!--{hook/collection_side_bottom}-->
template/default/forum/discuz.htm *<!--{hook/index_status_extra}-->
template/default/forum/discuz.htm *<!--{hook/index_nav_extra}-->
template/default/forum/discuz.htm *<!--{hook/index_top}-->
template/default/forum/discuz.htm *<!--{hook/index_catlist_top}-->
template/default/forum/discuz.htm *<!--{hook/index_followcollection_extra $colletion[ctid]}-->
template/default/forum/discuz.htm *<!--{hook/index_favforum_extra $forum[fid]}-->
template/default/forum/discuz.htm *<!--{hook/index_favforum_extra $forum[fid]}-->
template/default/forum/discuz.htm *<!--{hook/index_catlist $cat[fid]}-->
template/default/forum/discuz.htm *<!--{hook/index_forum_extra $forum[fid]}-->
template/default/forum/discuz.htm *<!--{hook/index_forum_extra $forum[fid]}-->
template/default/forum/discuz.htm *<!--{hook/index_datacollection_extra $colletion[ctid]}-->
template/default/forum/discuz.htm *<!--{hook/index_middle}-->
template/default/forum/discuz.htm *<!--{hook/index_bottom}-->
template/default/forum/discuz.htm *<!--{hook/index_side_top}-->
template/default/forum/discuz.htm *<!--{hook/index_side_bottom}-->
template/default/forum/editor_menu_forum.htm *<!--{hook/post_image_btn_extra}-->
template/default/forum/editor_menu_forum.htm *<!--{hook/post_image_tab_extra}-->
template/default/forum/editor_menu_forum.htm *<!--{hook/post_attach_btn_extra}-->
template/default/forum/editor_menu_forum.htm *<!--{hook/post_attach_tab_extra}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_leftside_top}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_leftside_bottom}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_forumaction}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_modlink}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_top}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_middle}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_postbutton_top}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_threadtype_inner}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_filter_extra}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_threadtype_extra}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_bottom}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_side_top}-->
template/default/forum/forumdisplay.htm *<!--{hook/forumdisplay_side_bottom}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_content}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_func_extra}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_ctrl_extra}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/global_login_text}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_upload_extend}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_btn_extra}-->
template/default/forum/forumdisplay_fastpost.htm *<!--{hook/forumdisplay_fastpost_sync_method}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_filter_extra}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_thread $key}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_thread_subject $key}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_author $key}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_thread $key}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_author $key}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_threadlist_bottom}-->
template/default/forum/forumdisplay_list.htm *<!--{hook/forumdisplay_postbutton_bottom}-->
template/default/forum/forumdisplay_sort.htm *<!--{hook/forumdisplay_postbutton_bottom}-->
template/default/forum/forumdisplay_subforum.htm *<!--{hook/forumdisplay_subforum_extra $sub[fid]}-->
template/default/forum/forumdisplay_subforum.htm *<!--{hook/forumdisplay_subforum_extra $sub[fid]}-->
template/default/forum/guide.htm *<!--{hook/guide_nav_extra}-->
template/default/forum/guide.htm *<!--{hook/guide_top}-->
template/default/forum/guide.htm *<!--{hook/guide_bottom}-->
template/default/forum/index_navbar.htm *<!--{hook/index_navbar}-->
template/default/forum/post.htm *<!--{hook/post_top}-->
template/default/forum/post.htm *<!--{hook/post_middle}-->
template/default/forum/post.htm *<!--{hook/post_btn_extra}-->
template/default/forum/post.htm *<!--{hook/post_sync_method}-->
template/default/forum/post.htm *<!--{hook/post_bottom}-->
template/default/forum/post.htm *<!--{hook/post_upload_extend}-->
template/default/forum/post_activity.htm *<!--{hook/post_activity_extra}-->
template/default/forum/post_debate.htm *<!--{hook/post_debate_extra}-->
template/default/forum/post_editor_attribute.htm *<!--{hook/post_attribute_extra}-->
template/default/forum/post_editor_attribute.htm *<!--{hook/post_attribute_extra_body}-->
template/default/forum/post_editor_body.htm *<!--{hook/post_editorctrl_right}-->
template/default/forum/post_editor_body.htm *<!--{hook/post_editorctrl_left}-->
template/default/forum/post_editor_body.htm *<!--{hook/post_editorctrl_top}-->
template/default/forum/post_editor_body.htm *<!--{hook/post_editorctrl_bottom}-->
template/default/forum/post_infloat.htm *<!--{hook/post_infloat_top}-->
template/default/forum/post_infloat.htm *<!--{hook/post_infloat_middle}-->
template/default/forum/post_infloat.htm *<!--{hook/post_infloat_btn_extra}-->
template/default/forum/post_poll.htm *<!--{hook/post_poll_extra}-->
template/default/forum/post_poll.htm *<!--{hook/post_poll_upload_extend}-->
template/default/forum/post_reward.htm *<!--{hook/post_reward_extra}-->
template/default/forum/post_trade.htm *<!--{hook/post_trade_extra}-->
template/default/forum/topicadmin_modlayer.htm *<!--{hook/forumdisplay_modlayer}-->
template/default/forum/topicadmin_modlayer.htm *<!--{hook/modcp_modlayer}-->
template/default/forum/trade_info.htm *<!--{hook/viewthread_tradeinfo_extra}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_top}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_postbutton_top}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_modoption}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_beginline}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_title_extra}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_title_row}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_middle}-->
template/default/forum/viewthread.htm *<!--{hook/viewthread_bottom}-->
template/default/forum/viewthread_activity.htm *<!--{hook/viewthread_activity_extra1}-->
template/default/forum/viewthread_activity.htm *<!--{hook/viewthread_activity_extra2}-->
template/default/forum/viewthread_album.htm *<!--{hook/viewthread_beginline}-->
template/default/forum/viewthread_album.htm *<!--{hook/viewthread_useraction_prefix}-->
template/default/forum/viewthread_album.htm *<!--{hook/viewthread_useraction}-->
template/default/forum/viewthread_album.htm *<!--{hook/viewthread_bottom}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_side}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_content}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_func_extra}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_ctrl_extra}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/global_login_text}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_upload_extend}-->
template/default/forum/viewthread_fastpost.htm *<!--{hook/viewthread_fastpost_btn_extra}-->
template/default/forum/viewthread_from_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_from_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_from_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_from_node.htm *<!--{hook/viewthread_endline $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_profileside $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_imicons $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_magic_user $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_avatar $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_sidetop $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_sidebottom $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_share_method}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_useraction}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_postsightmlafter $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_postfooter $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_postaction $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_magic_thread}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_magic_post $postcount}-->
template/default/forum/viewthread_node.htm *<!--{hook/viewthread_endline $postcount}-->
template/default/forum/viewthread_node_body.htm *<!--{hook/viewthread_posttop $postcount}-->
template/default/forum/viewthread_node_body.htm *<!--{hook/global_login_text}-->
template/default/forum/viewthread_node_body.htm *<!--{hook/viewthread_modaction}-->
template/default/forum/viewthread_node_body.htm *<!--{hook/global_login_text}-->
template/default/forum/viewthread_node_body.htm *<!--{hook/viewthread_postbottom $postcount}-->
template/default/forum/viewthread_poll.htm *<!--{hook/viewthread_poll_top}-->
template/default/forum/viewthread_poll.htm *<!--{hook/viewthread_poll_bottom}-->
template/default/forum/viewthread_portal.htm *<!--{hook/viewthread_useraction_prefix}-->
template/default/forum/viewthread_portal.htm *<!--{hook/viewthread_useraction}-->
template/default/forum/viewthread_portal.htm *<!--{hook/viewthread_side_bottom}-->
template/default/forum/viewthread_preview_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_preview_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_preview_node.htm *<!--{hook/viewthread_postheader $postcount}-->
template/default/forum/viewthread_preview_node.htm *<!--{hook/viewthread_endline $postcount}-->
template/default/forum/viewthread_trade.htm *<!--{hook/viewthread_trade_extra $key}-->
template/default/group/group.htm *<!--{hook/group_navlink}-->
template/default/group/group.htm *<!--{hook/forumdisplay_navlink}-->
template/default/group/group.htm *<!--{hook/group_navlink}-->
template/default/group/group.htm *<!--{hook/forumdisplay_navlink}-->
template/default/group/group.htm *<!--{hook/group_top}-->
template/default/group/group.htm *<!--{hook/forumdisplay_top}-->
template/default/group/group.htm *<!--{hook/group_nav_extra}-->
template/default/group/group.htm *<!--{hook/forumdisplay_nav_extra}-->
template/default/group/group.htm *<!--{hook/group_bottom}-->
template/default/group/group.htm *<!--{hook/forumdisplay_bottom}-->
template/default/group/group.htm *<!--{hook/group_side_bottom}-->
template/default/group/group.htm *<!--{hook/forumdisplay_side_bottom}-->
template/default/group/group_list.htm *<!--{hook/forumdisplay_postbutton_top}-->
template/default/group/group_list.htm *<!--{hook/forumdisplay_filter_extra}-->
template/default/group/group_list.htm *<!--{hook/forumdisplay_thread $key}-->
template/default/group/group_list.htm *<!--{hook/forumdisplay_postbutton_bottom}-->
template/default/group/group_my.htm *<!--{hook/my_header}-->
template/default/group/group_my.htm *<!--{hook/my_bottom}-->
template/default/group/group_my.htm *<!--{hook/my_side_top}-->
template/default/group/group_my.htm *<!--{hook/my_side_bottom}-->
template/default/group/group_right.htm *<!--{hook/group_index_side}-->
template/default/group/group_right.htm *<!--{hook/group_side_top}-->
template/default/group/group_right.htm *<!--{hook/forumdisplay_side_top}-->
template/default/group/index.htm *<!--{hook/index_header}-->
template/default/group/index.htm *<!--{hook/index_top}-->
template/default/group/index.htm *<!--{hook/index_bottom}-->
template/default/group/index.htm *<!--{hook/index_side_top}-->
template/default/group/index.htm *<!--{hook/index_side_bottom}-->
template/default/group/type.htm *<!--{hook/index_top}-->
template/default/group/type.htm *<!--{hook/index_grouplist $fid}-->
template/default/group/type.htm *<!--{hook/index_bottom}-->
template/default/group/type.htm *<!--{hook/index_side_top}-->
template/default/group/type.htm *<!--{hook/index_side_bottom}-->
template/default/home/editor_image_menu.htm *<!--{hook/spacecp_blog_upload_extend}-->
template/default/home/editor_image_menu.htm *<!--{hook/portalcp_top_upload_extend}-->
template/default/home/follow_feed.htm *<!--{hook/follow_nav_extra}-->
template/default/home/follow_feed.htm *<!--{hook/follow_top}-->
template/default/home/follow_feed.htm *<!--{hook/follow_upload_extend}-->
template/default/home/follow_feed.htm *<!--{hook/follow_nav_extra}-->
template/default/home/spacecp_avatar.htm *<!--{hook/spacecp_avatar_top}-->
template/default/home/spacecp_avatar.htm *<!--{hook/spacecp_avatar_bottom}-->
template/default/home/spacecp_blog.htm *<!--{hook/spacecp_blog_top}-->
template/default/home/spacecp_blog.htm *<!--{hook/spacecp_blog_middle}-->
template/default/home/spacecp_blog.htm *<!--{hook/spacecp_blog_bottom}-->
template/default/home/spacecp_credit_base.htm *<!--{hook/spacecp_credit_top}-->
template/default/home/spacecp_credit_base.htm *<!--{hook/spacecp_credit_extra}-->
template/default/home/spacecp_credit_base.htm *<!--{hook/spacecp_credit_bottom}-->
template/default/home/spacecp_credit_log.htm *<!--{hook/spacecp_credit_top}-->
template/default/home/spacecp_credit_log.htm *<!--{hook/spacecp_credit_bottom}-->
template/default/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_top}-->
template/default/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_base_extra}-->
template/default/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_feed_extra}-->
template/default/home/spacecp_privacy.htm *<!--{hook/spacecp_privacy_bottom}-->
template/default/home/spacecp_profile.htm *<!--{hook/spacecp_profile_top}-->
template/default/home/spacecp_profile.htm *<!--{hook/spacecp_profile_extra}-->
template/default/home/spacecp_profile.htm *<!--{hook/spacecp_profile_bottom}-->
template/default/home/spacecp_promotion.htm *<!--{hook/spacecp_promotion_top}-->
template/default/home/spacecp_promotion.htm *<!--{hook/spacecp_promotion_bottom}-->
template/default/home/spacecp_upload.htm *<!--{hook/spacecp_upload_extend}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_top}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_bottom}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_top}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_bottom}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_top}-->
template/default/home/spacecp_usergroup.htm *<!--{hook/spacecp_usergroup_bottom}-->
template/default/home/space_album_pic.htm *<!--{hook/space_album_pic_top}-->
template/default/home/space_album_pic.htm *<!--{hook/space_album_pic_op_extra}-->
template/default/home/space_album_pic.htm *<!--{hook/space_album_pic_bottom}-->
template/default/home/space_album_pic.htm *<!--{hook/space_album_pic_face_extra}-->
template/default/home/space_album_view.htm *<!--{hook/space_album_op_extra}-->
template/default/home/space_blog_list.htm *<!--{hook/space_blog_list_status $k}-->
template/default/home/space_blog_view.htm *<!--{hook/space_blog_title}-->
template/default/home/space_blog_view.htm *<!--{hook/space_blog_share_method}-->
template/default/home/space_blog_view.htm *<!--{hook/space_blog_op_extra}-->
template/default/home/space_blog_view.htm *<!--{hook/space_blog_face_extra}-->
template/default/home/space_card.htm *<!--{hook/space_card_top}-->
template/default/home/space_card.htm *<!--{hook/space_card_baseinfo_middle}-->
template/default/home/space_card.htm *<!--{hook/space_card_baseinfo_bottom}-->
template/default/home/space_card.htm *<!--{hook/space_card_option}-->
template/default/home/space_card.htm *<!--{hook/space_card_magic_user}-->
template/default/home/space_card.htm *<!--{hook/space_card_bottom}-->
template/default/home/space_comment_li.htm *<!--{hook/global_space_comment_op $k}-->
template/default/home/space_comment_li.htm *<!--{hook/global_comment_bottom}-->
template/default/home/space_doing.htm *<!--{hook/space_doing_top}-->
template/default/home/space_doing.htm *<!--{hook/space_doing_bottom}-->
template/default/home/space_favorite.htm *<!--{hook/space_favorite_nav_extra}-->
template/default/home/space_friend.htm *<!--{hook/space_interaction_extra}-->
template/default/home/space_header.htm *<!--{hook/global_usernav_extra1}-->
template/default/home/space_header.htm *<!--{hook/global_usernav_extra2}-->
template/default/home/space_home.htm *<!--{hook/space_home_navlink}-->
template/default/home/space_home.htm *<!--{hook/space_home_side_top}-->
template/default/home/space_home.htm *<!--{hook/space_home_side_bottom}-->
template/default/home/space_home.htm *<!--{hook/space_home_top}-->
template/default/home/space_home.htm *<!--{hook/space_home_navlink}-->
template/default/home/space_home.htm *<!--{hook/space_home_bottom}-->
template/default/home/space_magic.htm *<!--{hook/magic_nav_extra}-->
template/default/home/space_medal.htm *<!--{hook/medal_nav_extra}-->
template/default/home/space_menu.htm *<!--{hook/space_menu_extra}-->
template/default/home/space_profile_body.htm *<!--{hook/space_profile_baseinfo_top}-->
template/default/home/space_profile_body.htm *<!--{hook/follow_profile_baseinfo_top}-->
template/default/home/space_profile_body.htm *<!--{hook/space_profile_baseinfo_middle}-->
template/default/home/space_profile_body.htm *<!--{hook/follow_profile_baseinfo_middle}-->
template/default/home/space_profile_body.htm *<!--{hook/space_profile_baseinfo_bottom}-->
template/default/home/space_profile_body.htm *<!--{hook/follow_profile_baseinfo_bottom}-->
template/default/home/space_profile_body.htm *<!--{hook/space_profile_extrainfo}-->
template/default/home/space_profile_body.htm *<!--{hook/follow_profile_extrainfo}-->
template/default/home/space_share_li.htm *<!--{hook/space_share_comment_op $k}-->
template/default/home/space_status.htm *<!--{hook/space_home_doing_sync_method}-->
template/default/home/space_wall.htm *<!--{hook/space_wall_face_extra}-->
template/default/member/login.htm *<!--{hook/logging_side_top}-->
template/default/member/login.htm *<!--{hook/logging_top}-->
template/default/member/login.htm *<!--{hook/logging_input}-->
template/default/member/login.htm *<!--{hook/logging_method}-->
template/default/member/login_simple.htm *<!--{hook/global_login_extra}-->
template/default/member/register.htm *<!--{hook/register_side_top}-->
template/default/member/register.htm *<!--{hook/register_top}-->
template/default/member/register.htm *<!--{hook/register_input}-->
template/default/member/register.htm *<!--{hook/register_logging_method}-->
template/default/member/register.htm *<!--{hook/register_bottom}-->
template/default/mobile/common/footer.htm *<!--{hook/global_footer_mobile}-->
template/default/mobile/common/header.htm *<!--{hook/global_header_mobile}-->
template/default/mobile/forum/discuz.htm *<!--{hook/index_top_mobile}-->
template/default/mobile/forum/discuz.htm *<!--{hook/index_middle_mobile}-->
template/default/mobile/forum/discuz.htm *<!--{hook/index_bottom_mobile}-->
template/default/mobile/forum/forumdisplay.htm *<!--{hook/forumdisplay_top_mobile}-->
template/default/mobile/forum/forumdisplay.htm *<!--{hook/forumdisplay_thread_mobile $key}-->
template/default/mobile/forum/forumdisplay.htm *<!--{hook/forumdisplay_bottom_mobile}-->
template/default/mobile/forum/viewthread.htm *<!--{hook/viewthread_top_mobile}-->
template/default/mobile/forum/viewthread.htm *<!--{hook/viewthread_posttop_mobile $postcount}-->
template/default/mobile/forum/viewthread.htm *<!--{hook/viewthread_postbottom_mobile $postcount}-->
template/default/mobile/forum/viewthread.htm *<!--{hook/viewthread_bottom_mobile}-->
template/default/portal/portalcp_article.htm *<!--{hook/portalcp_top}-->
template/default/portal/portalcp_article.htm *<!--{hook/portalcp_extend}-->
template/default/portal/portalcp_article.htm *<!--{hook/portalcp_middle}-->
template/default/portal/portalcp_article.htm *<!--{hook/portalcp_bottom}-->
template/default/portal/view.htm *<!--{hook/view_article_top}-->
template/default/portal/view.htm *<!--{hook/view_article_subtitle}-->
template/default/portal/view.htm *<!--{hook/view_article_summary}-->
template/default/portal/view.htm *<!--{hook/view_article_content}-->
template/default/portal/view.htm *<!--{hook/view_share_method}-->
template/default/portal/view.htm *<!--{hook/view_article_op_extra}-->
template/default/portal/view.htm *<!--{hook/view_article_side_top}-->
template/default/portal/view.htm *<!--{hook/view_article_side_bottom}-->
template/default/ranklist/side_left.htm *<!--{hook/ranklist_nav_extra}-->
template/default/search/album.htm *<!--{hook/album_top}-->
template/default/search/album.htm *<!--{hook/album_bottom}-->
template/default/search/blog.htm *<!--{hook/blog_top}-->
template/default/search/blog.htm *<!--{hook/blog_bottom}-->
template/default/search/collection.htm *<!--{hook/collection_top}-->
template/default/search/collection.htm *<!--{hook/collection_bottom}-->
template/default/search/footer.htm *<!--{hook/global_footer}-->
template/default/search/footer.htm *<!--{hook/global_footerlink}-->
template/default/search/forum.htm *<!--{hook/forum_top}-->
template/default/search/forum.htm *<!--{hook/forum_bottom}-->
template/default/search/group.htm *<!--{hook/group_top}-->
template/default/search/group.htm *<!--{hook/group_bottom}-->
template/default/search/header.htm *<!--{hook/global_usernav_extra1}-->
template/default/search/header.htm *<!--{hook/global_usernav_extra2}-->
template/default/search/portal.htm *<!--{hook/portal_top}-->
template/default/search/portal.htm *<!--{hook/portal_bottom}-->
template/default/touch/common/footer.htm *<!--{hook/global_footer_mobile}-->
template/default/touch/common/header.htm *<!--{hook/global_header_mobile}-->
template/default/touch/forum/discuz.htm *<!--{hook/index_top_mobile}-->
template/default/touch/forum/discuz.htm *<!--{hook/index_middle_mobile}-->
template/default/touch/forum/forumdisplay.htm *<!--{hook/forumdisplay_top_mobile}-->
template/default/touch/forum/forumdisplay.htm *<!--{hook/forumdisplay_thread_mobile $key}-->
template/default/touch/forum/forumdisplay.htm *<!--{hook/forumdisplay_bottom_mobile}-->
template/default/touch/forum/forumdisplay_fastpost.htm *<!--{hook/viewthread_fastpost_button_mobile}-->
template/default/touch/forum/post.htm *<!--{hook/post_bottom_mobile}-->
template/default/touch/forum/viewthread.htm *<!--{hook/viewthread_top_mobile}-->
template/default/touch/forum/viewthread.htm *<!--{hook/viewthread_posttop_mobile $postcount}-->
template/default/touch/forum/viewthread.htm *<!--{hook/viewthread_postbottom_mobile $postcount}-->
template/default/touch/forum/viewthread.htm *<!--{hook/viewthread_bottom_mobile}-->
template/default/touch/member/login.htm *<!--{hook/logging_bottom_mobile}-->
template/default/userapp/userapp_app.htm *<!--{hook/userapp_app_top}-->
template/default/userapp/userapp_app.htm *<!--{hook/userapp_app_bottom}-->
template/default/userapp/userapp_menu_list.htm *<!--{hook/userapp_menu_top}-->
template/default/userapp/userapp_menu_list.htm *<!--{hook/userapp_menu_middle}-->
template/default/userapp/userapp_menu_list.htm *<!--{hook/userapp_menu_bottom}-->
template/default/wml/common/footer.htm *<!--{hook/global_footer_mobile}-->
template/default/wml/common/header.htm *<!--{hook/global_header_mobile}-->
template/default/wml/forum/discuz.htm *<!--{hook/index_top_mobile}-->
template/default/wml/forum/discuz.htm *<!--{hook/index_middle_mobile}-->
template/default/wml/forum/forumdisplay.htm *<!--{hook/forumdisplay_top_mobile}-->
template/default/wml/forum/forumdisplay.htm *<!--{hook/forumdisplay_thread_mobile $key}-->
template/default/wml/forum/forumdisplay.htm *<!--{hook/forumdisplay_bottom_mobile}-->
template/default/wml/forum/viewthread.htm *<!--{hook/viewthread_top_mobile}-->
template/default/wml/forum/viewthread.htm *<!--{hook/viewthread_posttop_mobile $postcount}-->
template/default/wml/forum/viewthread.htm *<!--{hook/viewthread_postbottom_mobile $postcount}-->
template/default/wml/forum/viewthread.htm *<!--{hook/viewthread_bottom_mobile}-->

下面内容来自discuz开发手册:
  • <!--{hook/xxx_xxx}-->


插件钩子的作用在于能让插件在指定的一些位置输出有关代码!
在DZ7.x-DX1.5中插件钩子并不显得很重要,但是随着插件应用的不断普及,插件创作者的不断加入,插件钩子在模板中的地位尤其显得格外重要,如果缺少了程序必须的插件钩子,可能会造成自带系统插件功能受到影响!

所以我们在制作模板的时候一定要参考默认模板中的插件钩子位置进行合理的安排!
除非你觉得某个插件钩子在自己的模板中并不需要,否则请保留插件钩子代码!





9#
 楼主| 51haoyouadmin 2019-2-2

程序代码如何修改,使DIY模块中最新热帖数据和最新回复数据的正确获得

在/source/class/block/forum/block_thread.php中
1.
找到
                if($orderby == 'heats') {
                        $sql .= " AND t.heats>'0'";
                }
将其修改并添加成为
                if($orderby == 'heats') {
                        $sql .= " AND t.heats>'1'";
                }
                if($orderby == 'lastpost' && !$digest) {
                        $sql .= " AND t.replies>'0'";
                }
2.
找到
                $maxwhere = '';
                if(!$tids && !$fids && !$digest && !$stick && $_G['setting']['blockmaxaggregationitem']) {
                        $maxwhere = ($maxid = $this->getmaxid() - $_G['setting']['blockmaxaggregationitem']) > 0 ? 't.tid > '.$maxid.' AND ' : '';
                }
将其添加3行成为
                $maxwhere = '';
                if(!$tids && !$fids && !$digest && !$stick && $_G['setting']['blockmaxaggregationitem']) {
                        $maxwhere = ($maxid = $this->getmaxid() - $_G['setting']['blockmaxaggregationitem']) > 0 ? 't.tid > '.$maxid.' AND ' : '';
                }
                if($orderby == 'heats') {
                        $orderby = "lastpost";
                }

今天我也是回忆了一段时间,才确定修改的地方,不记录下来,以后我也忘了。这是这个php文件中的关键修改,其它小的调整不细说了。

www.51haoyou.com

GMT-4, 2024-5-17 08:08

© 2005-

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