The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hi,
I just started a new website and switched over to vBulletin from phpBB. The last website I had, I was able to integrate forum posts within my site index. I used this code before: http://deceptive-logic.com/tutorial/php/topic with a little bit of tweaking. I want to do the same thing, but use vBulletin. I forgot how to do a lot of coding, but I used to be decent with it (It's been 4 years since I last coded any time of script). If someone could please link me to a tutorial or be nice enough to place the required code I need, I would be very thankful. If you have any questions please PM me. Thank you! - Walter --------------- Added [DATE]1235538702[/DATE] at [TIME]1235538702[/TIME] --------------- Basically we want to integrate a particular forum/thread to show topics on our homepage. Our home page will be HTML. |
|
#2
|
||||
|
||||
|
Just include global.php, and run a query to fetch this data.
PHP Code:
|
|
#3
|
|||
|
|||
|
can we get a little more clarification on this? How in fact do we run a query to fetch that data.
This is what we have so far: Code:
LINE 50<?php include(Forum/global.php);
$threads = $vbulletin->db->query_read("
SELECT *
FROM " . blakecul_vbullet . "thread
WHERE forumid = 2
ORDER BY dateline DESC
LIMIT 5
");
while ($thread = $vbulletin->db->fetch_array($threads))
{
// thread data is in $thread
} ?>
|
|
#4
|
||||
|
||||
|
You must use quotes, and include global.php like so: (This bit of code has been posted around a lot.)
PHP Code:
|
|
#5
|
|||
|
|||
|
Thank you! I think I'm a few steps short of getting it to work now since it's no longer stretching the tables and giving me errors. Now to get the threads to appear I assume I put something to display the threads here:
Code:
{
// thread data is in $thread
}
This is the page in particular: http://www.ydnfutc.com/layoutsliced.php The big white content box on the right is where the threads would be appearing. What code do I use to display $thread |
|
#6
|
||||
|
||||
|
As mentioned, all the thread's data is in an array in $thread. You need to process this data to whatever way you want.
|
|
#7
|
|||
|
|||
|
Okay, I did an array dump. I can't find the body of the post in that array (like the stuff I'm typing right now)
What I'm trying to do is go: Quote:
|
|
#8
|
|||
|
|||
|
Well I'm a newbie to php. How would you display the data in $thread in the following loop:
while ($thread = $vbulletin->db->fetch_array($threads)) { // display data is in $thread } ?> |
|
#9
|
|||
|
|||
|
Well, I did something called a dump, which shows you all the data inside the array. You need to replace this:
Code:
while ($thread = $vbulletin->db->fetch_array($threads))
{
// display data is in $thread
}
Code:
while ($thread = $vbulletin->db->fetch_array($threads))
{
echo "<pre>";var_dump($thread);die;
}
For me, I needed to gather the Title of the thread and the persons name who posted the thread, so it was in the format "Thread Title!" - By UsernameHere The two variables for that are ['title'] and ['postusername']. Once you have the variables you need, You can gather them by using an echo function: Code:
while ($thread = $vbulletin->db->fetch_array($threads))
{
echo $thread['title']." - By ".$thread['postusername']."<br>";
}
Code:
{
echo $thread['title']
}
|
|
#10
|
|||
|
|||
|
Thank you veru much, appreciated !
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|