View Full Version : Feed latest topics onto a non vb page
hi
how would i Feed latest topics onto a non vb page
thanx
eg
www.ukmusic.com bottom right corner
sambah
06-05-2006, 01:26 AM
$result = mysql_query("SELECT * FROM teensay_vbboardscurrent.thread WHERE forumid!=59 AND forumid!=62 ORDER BY 'threadid' DES$
$count = 0;
while ($row = mysql_fetch_array($result)) {
$count++;
( (is_float($count/2)) ? $color = '#E8F2FF' : $color='#C1DCFF' );
$tpl->assign('ht_bg', $color);
$tpl->assign('ht_id', $row['threadid']);
$tpl->assign('ht_title', $row['title']);
$tpl->assign('ht_name', $row['lastposter']);
$tpl->assign('ht_date', date("d.m.y h:i:s",$row['lastpost']));
$hottopics .= $tpl->parse($templatepath.'/home/hottopics_template.html');
}
$ch .= '</table>';
Should work for you :)
m.. lookin for more help as i wudnt no where to put thid
WEBDosser
06-05-2006, 07:23 AM
$result = mysql_query("SELECT * FROM teensay_vbboardscurrent.thread WHERE forumid!=59 AND forumid!=62 ORDER BY 'threadid' DES$
$count = 0;
while ($row = mysql_fetch_array($result)) {
$count++;
( (is_float($count/2)) ? $color = '#E8F2FF' : $color='#C1DCFF' );
$tpl->assign('ht_bg', $color);
$tpl->assign('ht_id', $row['threadid']);
$tpl->assign('ht_title', $row['title']);
$tpl->assign('ht_name', $row['lastposter']);
$tpl->assign('ht_date', date("d.m.y h:i:s",$row['lastpost']));
$hottopics .= $tpl->parse($templatepath.'/home/hottopics_template.html');
}
$ch .= '</table>';
Should work for you :)
how would this work?.. looks like it not even part of vBulletin.
sambah
06-05-2006, 07:31 AM
m.. lookin for more help as i wudnt no where to put thid
Obviously you need to change the sql query line:
$result = mysql_query("SELECT * FROM yourdbname.thread WHERE forumid!=59 AND forumid!=62 ORDER BY 'threadid' DES$
The bolded parts need changed:
yourdbname needs to be your forums database name
The forum ID numbers are just forumid's that you dont want to display in the latest posts eg. staffroom, debug, etc
You'll also need to include a config.php file or something with your db details in it
Also thats just the code needed. you'll need to stick it in the design yourself :)
im to lost to doit sorry but im a newbie so i need it to be like a hack with instructions lol
SaintDog
06-07-2006, 05:34 AM
It really depends on what specifically your looking to pull and how you want the information pulled. The above doesn't make use of vBulletin's coding directly or allow you open modification from the template system (which would ease how you display the data).
Insert the following into your PHP file.
$getthreads = $vbulletin->db->query_read("
SELECT * FROM thread
WHERE forumid = ''
LIMIT 5
ORDER BY threadid
DESC
");
while ($threads = $vbulletin->db->fetch_array($getthreads))
{
$dateposted = vbdate('m-d-Y', $news['postdateline']);
eval('print_output("' . fetch_template('latest_thread_display') . '");');
}
Then, create a new template through the vBulletin Admin Control Panel named 'latest_thread_display' (without quotes) and insert the following:
$thread[title]
<br />
Posted By: $thread[postusername]
<br />
Posted On: $dateposted
<br />
<br />
The above MySQL Query will pull the last 5 threads from the database and use the 'latest_thread_display' template as the acting template to display the data.
To use the above, however, you will need to include global.php within your PHP file, as noted below, else the functions will not...function :).
require_once('./global.php');
this is what my file looks like and get error on
http://www.globalvibez.com/test.php
<?php
chdir('/home/global/public_html/forum');
require_once('/home/global/public_html/forum/global.php');
?>
<?php
$getthreads = $vbulletin->db->query_read("
SELECT * FROM thread
WHERE forumid = ''
LIMIT 5
ORDER BY threadid
DESC
");
while ($threads = $vbulletin->db->fetch_array($getthreads))
{
$dateposted = vbdate('m-d-Y', $news['postdateline']);
eval('print_output("' . fetch_template('latest_thread_display') . '");');
}
?>
$thread[title]
Posted By: $thread[postusername]
Posted On: $dateposted
SaintDog
06-08-2006, 01:14 AM
Ok, here's what you need to do :-).
Create a PHP file called testing.php and insert the following inside (verbatim)
<?php
require_once('path/to/global.php');
$getthreads = $vbulletin->db->query_read("
SELECT * FROM thread
WHERE forumid = ''
LIMIT 5
ORDER BY threadid
DESC
");
while ($threads = $vbulletin->db->fetch_array($getthreads))
{
$dateposted = vbdate('m-d-Y', $news['postdateline']);
eval('$threaddisplay .= "' . fetch_template('custom_latest_thread_display') . '";');
}
eval('print_output("' . fetch_template('custom_index') . '");');
?>
Via the AdminCP create a New Template within your vBulletin Style named 'custom_index' (without the quotes) and add to it the following:
$threaddisplay
Now create a new template called 'custom_latest_thread_display' (again, without the quotes) and insert the following into it.
$thread[title]
<br />
Posted By: $thread[postusername]
<br />
Posted On: $dateposted
<br />
<br />
You need to change the path to global.php to your corresponding path. If you are on a CPanel based server (i.e. you can login to your control panel via domain.com/cpanel), then you need to use /home/cpanelusername/public_html/forum/global.php.
Let me know if this works for you. If not, I will create a file for you myself and help you as much as I can given my free time :).
noppid
06-08-2006, 01:40 AM
Put javascript on the html page and pull your latest threads from your external.php.
Latest vBulletin Threads on HTML Pages with Javascript (http://www.cpurigs.com/forums/showthread.php?t=1951).
The file is a freebie. Use it as is or feel free to borrow from it.
Ok, here's what you need to do :-).
Create a PHP file called testing.php and insert the following inside (verbatim)
<?php
require_once('path/to/global.php');
$getthreads = $vbulletin->db->query_read("
SELECT * FROM thread
WHERE forumid = ''
LIMIT 5
ORDER BY threadid
DESC
");
while ($threads = $vbulletin->db->fetch_array($getthreads))
{
$dateposted = vbdate('m-d-Y', $news['postdateline']);
eval('$threaddisplay .= "' . fetch_template('custom_latest_thread_display') . '";');
}
eval('print_output("' . fetch_template('custom_index') . '");');
?>
Via the AdminCP create a New Template within your vBulletin Style named 'custom_index' (without the quotes) and add to it the following:
$threaddisplay
Now create a new template called 'custom_latest_thread_display' (again, without the quotes) and insert the following into it.
$thread[title]
<br />
Posted By: $thread[postusername]
<br />
Posted On: $dateposted
<br />
<br />
You need to change the path to global.php to your corresponding path. If you are on a CPanel based server (i.e. you can login to your control panel via domain.com/cpanel), then you need to use /home/cpanelusername/public_html/forum/global.php.
Let me know if this works for you. If not, I will create a file for you myself and help you as much as I can given my free time :).
i get errors still
http://www.globalvibez.com/test.php
ive done
Now create a new template called 'custom_latest_thread_display'
and done
custom_index
did the global.php to
and the php file
SaintDog
06-08-2006, 01:46 PM
Lord I need to get more sleep :).
Change:
$getthreads = $vbulletin->db->query_read("
SELECT * FROM thread
WHERE forumid = ''
LIMIT 5
ORDER BY threadid
DESC
");
To:
$getthreads = $vbulletin->db->query_read("
SELECT * FROM thread
WHERE forumid = ''
ORDER BY threadid
DESC
LIMIT 5
");
Also look at the WHERE forumid = '' - You need to enter the ID of the forum you wish to pull the data from between the ''.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.