PDA

View Full Version : How to display news from a forum?


Xarwin
08-28-2015, 12:40 PM
Hi everyone.

I'm coding a custom frontpage with vBulletin enhancements.
The only thing I can't find is a certain code to display threads out of a forum as news on this page.

An example would be like the portal frontpage here on vBulletin.org: https://vborg.vbsupport.ru/portal.php

They show 5 news posts from this forum: https://vborg.vbsupport.ru/forumdisplay.php?f=240

Help is appreciated!

Xarwin
09-01-2015, 07:59 PM
Bump..

Would appreciate any lead how to do it as well!

Dave
09-01-2015, 09:30 PM
You could do something like:


$query = $vbulletin->db->query_read("
SELECT a.title, a.threadid, a.lastpost, a.postusername, b.pagetext
FROM `thread` AS a
INNER JOIN post AS b ON a.firstpostid = b.postid
WHERE a.forumid = 2
ORDER BY a.threadid DESC
LIMIT 0,5");

while($row = $vbulletin->db->fetch_array($query))
{
// $row contains the data.
}


Where 2 would be your forum id.

Xarwin
09-04-2015, 11:25 AM
Thank you for the reply!

However.. Is there a guide how to use php it in a template?
I didn't used php coding before in vBulletin so I'm new to it.
I know its not directly into the template so any leads are welcome. I couldn't find guides or information about it...

HM666
09-06-2015, 08:01 AM
Uhm I believe what Dave gave you was a plugin. Its really not possible to put PHP directly into the template without a lot of headaches and coding I do not think anyways. And why did you start a new thread asking pretty much the same thing HERE (https://vborg.vbsupport.ru/showthread.php?t=320116)?