vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   How to get thread's links? (https://vborg.vbsupport.ru/showthread.php?t=292940)

SupportAM 12-13-2012 12:47 AM

How to get thread's links?
 
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

Code:

$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

PHP Code:

  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


All times are GMT. The time now is 06:53 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00982 seconds
  • Memory Usage 1,715KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete