The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Trying to add Popoular Threads Block
I need to add a popular threads block to my forum sidebar, I do not need a cms widget I already have that working. I found some code on vbulletin.com forums but NO ONE wants to answer questions on how to make it work. Maybe someone here can help me. I just need to make this code work in a forum block. This is the code:
Code:
global $vbulletin; $msglength = 150; $dots = '...'; $thread = $vbulletin->db->query_read("SELECT thread.threadid, thread.title, thread.views, post.pagetext AS message FROM " . TABLE_PREFIX . "thread AS thread LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid) WHERE 1=1 ORDER BY thread.views DESC LIMIT 0,5"); $row = array(); if ($vbulletin->db->num_rows($thread) > 0) { while($rowthread = $vbulletin->db->fetch_array($thread)){ $row[] = array( 'contentid' => $rowthread['threadid'], 'message' => $rowthread['message'], 'url' => fetch_seo_url('thread', $rowthread), 'title' => $rowthread['title'], 'views' => $rowthread['views']); } } $static = '<ul>'; for($i = 0; $i < count($row); $i++) { $static .= '<li>'; $static .= '<a href="' .$row[$i]['url'] . '"><b>' . $row[$i]['title'] . '</b></a><br/> '; $static .= '<span style="font-size:11px">(' . $row[$i]['views'] . ' views)</span>'; if(strlen($row[$i]['message']) > $msglength) { $row[$i]['message'] = substr($row[$i]['message'],0,$msglength); $row[$i]['message'] = substr($row[$i]['message'],0,strrpos($row[$i]['message']," ")) . $dots; } $static .= '<ul>'; $static .= '<li>'; $static .= strip_bbcode($row[$i]['message'],true,true,false,true,false) . '<br/><br/>'; $static .= '</li>'; $static .= '</ul>'; $static .= '</li>'; } $static .= '</ul>'; $output = $static; Code:
Specify the content you want to display. If this is PHP code, use a return statement to send your output to the block. For example: $my_output = 'Hello, world.'; return $my_output; |
#2
|
||||
|
||||
Try changing the last line in your code from
PHP Code:
PHP Code:
|
#3
|
|||
|
|||
Thanks we found a solution in using the built in blocks. I missed a setting for forum threads that did just what we needed.
|
#4
|
|||
|
|||
How can this be edited to show the most popular threads from the last 24 hours?
|
#5
|
|||
|
|||
I have no idea as I got the code off vbulletin.com in another thread discussing the widgets & blocks.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|