The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Hello,
I want to connect content on my main page to discussions on my vBB. What I'd like to do is have a "Comment on This (x Comments)" where x is equal to the number of posts in a given thread. I've learned how to create a basic vB powered page: http://www.weeklydavespeak.com/testi.../php2/test.php which is based on this code: http://www.weeklydavespeak.com/testi...2/test_php.txt Suppose I know the thread number, i.e. http://www.weeklydavespeak.com/forum...thread.php?t=2 This appears to be Thread 2, how do i query the database to get the current number of posts in there? Thanks ya'll. Rob |
#2
|
||||
|
||||
![]()
As you are using the vBulletin backend you can use it's library functions:
PHP Code:
|
#3
|
|||
|
|||
![]() Quote:
Thanks a lot--that helps a bunch. Where can I find a list of vBulletin's other library functions? Rob |
#4
|
||||
|
||||
![]()
Take alook in the various files in your includes folder, all the files in the format functions_X.php (and functions.php) contain all the main vBulletin fuinctions, the X represents they type of functions the file contains, calendar, user etc.
|
#5
|
|||
|
|||
![]() Quote:
I'll have a look. Thank you. rob :alien: |
#6
|
|||
|
|||
![]()
Hello,
I need a bit of help understanding how to place this code. I'm a bit new at this, so thank you for your patience. The code you gave me looks like you're assigning an array of data to the variable $threadinfo. I looked and found that the fetch_threadinfo() function appears in the functions.php document. I get a Fatal error: Call to undefined function: fetch_threadinfo() when I attempt to make this assignment in my test.php file. Code:
<?php chdir("../../../forums"); $threadinfo = fetch_threadinfo(2); // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); <snip> ?> I would expect that this would resolve correctly leaving $threadinfo to contain the aforementioned array of data. My next step would be to print just the $threadinfo[replycount] out in the php file somehow. I'd welcome suggestions on how to accomplish this as well. To be abundantly clear of my intentions: I want to create a function that outputs the number of responses to a given thread in a forum. I plan to have this appear in a line of text "(x comments)" and then include() the output of this php file in larger html/php file (which contains the news story pictures etc.) Again, thank you for the help. rob |
#7
|
||||
|
||||
![]()
you should require global.php in your script, then it will create all the major functions you may need
(look at any vbulletin code file, to see what should be on the file's beginning) |
#8
|
|||
|
|||
![]() Quote:
Ah. Thanks, that worked. But then I got a fatal error saying that I can't pass a variable as a reference. I hacked at it and finally figured out that Code:
$threadinfo = fetch_threadinfo(2); Code:
$threadWanted = 2; $threadinfo = fetch_threadinfo($threadWanted); Code:
// ####################################################################### // ####################### Begin My Page ################################# $comment_news = "Comment on this News"; $comment_article = "Comment on this Article"; // Thread ID $threadWanted = 2; // URL to Thread Top $thread_URL = 'http://www.weeklydavespeak.com/forums/showthread.php?t=2'; // Pull array of thread info from database $threadinfo = fetch_threadinfo($threadWanted); // Output Text and Hyperlink echo "<a href='$thread_URL'>"; echo "$comment_news"; echo "</a>"; echo " ($threadinfo[replycount]", ' Comments)'; echo "<br>"; // ####################### End My Page ################################### // ####################################################################### Thanks to those of you who took the time to help me along. This is really my first php work, and first experience doing anything with vB. I'd welcome comments on the above code or other suggestions. My next step is to convert my SSI/SHTML pages into php and add lines like this to my story pages i.e.: The news article attached to the above code Oh, and overhall my forum's look and about a dozen other things. ![]() rob |
#9
|
|||
|
|||
![]()
I posted a How To on this, along with my completed script here: https://vborg.vbsupport.ru/showthread.php?t=67469
Thanks for your help, peeps. rob |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|