vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to show the amount of replies a thread has on a non-vB page? (https://vborg.vbsupport.ru/showthread.php?t=159996)

Shaliza 10-11-2007 11:57 AM

How to show the amount of replies a thread has on a non-vB page?
 
I want to use a forum for comments for my site instead of using a regular comments form. For example, if a thread has 10 replies, on the non-vB page, I'd like it to say 10 Comments. That's it. Nothing fancy

--------------- Added at 20:55 ---------------

Anyone? I need to get this done ASAP.

Shaliza 10-14-2007 06:11 AM

Anyone?

Shaliza 10-16-2007 01:20 AM

This is the last one.

RobDog888 10-16-2007 03:01 AM

<font color="darkgreen">You will want to query the thread table and pull out the "views" field.

Ex.

SELECT t.views AS views FROM thread WHERE threadid = 12345

</font>

Shaliza 10-24-2007 03:02 AM

How do I go about coding this onto my website exactly? Thanks for the help!

Kirk Y 10-24-2007 03:30 AM

Quote:

Originally Posted by RobDog888 (Post 1361265)
You will want to query the thread table and pull out the "views" field.

Ex.

SELECT t.views AS views FROM thread WHERE threadid = 12345


I think he wants replies.. not views. ;)

In any event, you'd want to include global.php on your external page and set the working dir. to your forum:
Code:

chdir('/path/to/your/forums');
require_once('/path/to/your/forums/global.php');

Then just query the database like robdog mentioned, something like this:
Code:

$query = $db->query_first("SELECT * FROM thread WHERE threadid = 1234");
Then you can use $query[replycount] to output the number of replies in thread 1234. Obviously this is just a basic example and needs expanded upon, but this should give you a general idea.

Keloran 10-24-2007 12:29 PM

if you have your own db code, then simply

SELECT replycount FROM thread WHERE threadid = <threadid> LIMIT 1

NEVER DO SELECT * unless you want absolutlly everything from the thread, which 9/10 you WONT

Kirk Y 10-24-2007 04:02 PM

Which is why I said "basic example"... he's going to want more than just the replycount field either way; at the least, he'll more than likely want the title and thread starter.

Shaliza 10-25-2007 02:14 AM

I'm a girl!

Actually, all I want is for it to say 10 Comments if there are 10 replies, ect. I don't want anything else with it. And I'm not too crazy familiar with vB coding, so I will try...

What is that $query[replycount] bit about though?

Shaliza 11-24-2007 01:19 PM

I have a problem. When I tried it, it said this on the site:

Fatal error: Call to a member function on a non-object


All times are GMT. The time now is 02:39 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.01094 seconds
  • Memory Usage 1,725KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete