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; |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|