View Full Version : How to get thread's links?
SupportAM
12-13-2012, 12:47 AM
I want to display last 10 threads on my website main page in a way that hyperlink takes user to actual forum thread.
I can see and pick threads titles from thread table. How to get link which I could use in hyperlink?
Lynne
12-13-2012, 02:24 AM
What is your current code you are using that is only displaying the thread titles? In the same thread table is a threadid which you should be able to use for the link.
NAZIA
10-07-2013, 10:04 AM
Connect your file with the database.
and use this query to get title and threadid from Thread table
$data = mysql_query("SELECT threadid, title FROM XX_thread WHERE forumid='10' order by threadid desc LIMIT 10") You can remove forumid='10' from the above query . because above query will get rows of the threads posted in forum ID 10..
After fetching rows. use them to display
while($news = mysql_fetch_array( $data ))
{
$title = $news['title'];
$thread = $news['threadid'];
$url = $news['title'];
$url = str_replace(' ','-' ,$url);
echo ' <a href="forum/showthread.php/'.$thread.'-'.$url.'" target="_top">'.$title.'</a>';
}
forum/showthread.php/ Because Advanced Friendly URL Type is enabled
thats it.
It will work for vbulletin 4.xx
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.