VBulletin HACK----Display the topic size and open a new window on the Forum index page

Source: Internet
Author: User
Tags query strlen thread vbulletin
VBulletin HACK
----Display the topic size and open a new window on the Forum index page
Author: gogosoft

"Show topic Size"
Cause: 1.1.4 does not have this feature, and some users will use this as a reference to whether to view the topic.
Advantages: Just add a few lines of code to it.
Disadvantage: Because every time you display the Forum index page, you need to calculate the total size of the topic on the page, so you may have some impact on the server.
Self-evaluation: This is a small function, dispensable, practical or not a matter of opinion.

Steps:
⒈ Open forumdisplay.php, find "
if ($announcement = $DB _site->query_first ("Select Announcementid,userid,startdate,title from Announcement WHERE startdate<= $datenow and enddate>= $datenow and (forumid= $forumid OR forumid=-1) Order by StartDate DESC LIMIT 1 ")) {
", add in the back"
Hack Thread Size
$size = 0;
$announcements = $DB _site->query ("Select Pagetext from announcement WHERE startdate<= $datenow and enddate>=$ Datenow and (forumid= $forumid OR forumid=-1) ");
while ($announce = $DB _site->fetch_array ($announcements)) $size +=strlen ($announce [Pagetext]);
$size =iif ($size >1024,number_format ($size/1024,1). " K ", $size);
End Hack Thread Size
", find"
while ($thread = $DB _site->fetch_array ($threads)) {
", add in the back"
Hack Thread Size
$size = 0;
$posts = $DB _site->query ("Select Pagetext from Post WHERE threadid=". $thread [ThreadID]);
while ($post = $DB _site->fetch_array ($posts)) $size +=strlen ($post [Pagetext]);
$size =iif ($size >1024,number_format ($size/1024,1). " K ", $size);
End Hack Thread Size
", Save the exit;

⒉ opens the Forumdisplay template in Control Panel to find the
&LT;TD Align=center><smallfont color= "{tableheadtextcolor}" ><B> reply </B></smallfont>
</td>
&LT;TD Align=center><smallfont color= "{tableheadtextcolor}" ><B> popularity </B></smallfont>
</td>
", add in the back"
&LT;TD Align=center><smallfont color= "{tableheadtextcolor}" ><B> size </B></smallfont>
</td>
", find"
&LT;TD valign= "Middle" width= "100%" colspan= "7" >
", replace with"
&LT;TD valign= "Middle" width= "100%" colspan= "8" >
Save Open the Forumdisplaybit template to find the
&LT;TD align=center bgcolor= "{Firstaltcolor}" >
<normalfont> $replies </normalfont>
</td>

&LT;TD align=center bgcolor= "{Secondaltcolor}" >
<normalfont> $views </normalfont>
</td>
", add in the back"
&LT;TD align=center bgcolor= "{Secondaltcolor}" >
<normalfont> $size </normalfont>
</td>
", open forumdisplay_announcement template, find"
&LT;TD align=center bgcolor= "{Firstaltcolor}" >
<normalfont>-</normalfont>
</td>

&LT;TD align=center bgcolor= "{Secondaltcolor}" >
<normalfont>-</normalfont>
</td>
", add in the back"
&LT;TD align=center bgcolor= "{Secondaltcolor}" >
<normalfont> $size </normalfont>
</td>
", save. Complete!


"Open a new Window"
Reason: This is useful for browsing a frequently updated forum, where users can easily open a wide range of different topics of the window.
Advantage: It's simple, just change the template to achieve it-it doesn't seem to belong to hack. :)
Disadvantage: You can only open a new window on the first page of the topic, and other pages, or hold down shift.

Steps: Control Panel-> Template-> Edit, open forumdisplaybit, find "
<td bgcolor= "{firstaltcolor}" width= "100%" ><normalfont>
$gotonew <a href= "showthread.php?threadid= $threadid" > $threadtitle </a>
", behind or in front of the $gotonew ($gotonew is the" new post "icon) joins"
<a href= "showthread.php?threadid= $threadid" target= "_blank" ></a>
"Of course, you have to prepare a small icon for this connection to open a new window and upload it to the images directory." Complete!

Example: http://gogosoft.oso.com.cn/forum/forumdisplay.php?forumid=4



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.