vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Howto: have the 10 newest posts on my homepage (https://vborg.vbsupport.ru/showthread.php?t=155220)

jer2eydevil88 08-14-2007 04:02 PM

Howto: have the 10 newest posts on my homepage
 
I would like to have the 10 newest posts titles show up on the homepage for my site, the best idea I can come up with is to use an rss feed reader (although I don't think the forum software supports feeds) or something equivalent to that unless someone has a better idea.

nico_swd 08-14-2007 09:36 PM

Quote:

Originally Posted by jer2eydevil88 (Post 1317436)
(although I don't think the forum software supports feeds)

https://vborg.vbsupport.ru/faq.php?f...ss_syndication

EnIgMa1234 08-14-2007 10:13 PM

Create a new plugin

Product: vBulletin
Hook: forumhome_complete

In the box add:
PHP Code:

$query $vbulletin->db->query_read("SELECT * FROM " TABLE_PREFIX "thread ORDER BY lastpost DESC LIMIT 10");

while (
$last $vbulletin->db->fetch_array($query))
{
$lasttitle $last['title']<br />;


Now you can use $lasttitle in your forumhome template

amnesia623 09-03-2007 10:36 PM

This only displays one 'latest thread'

Is there a way to fix it?
Thanks!

Opserty 09-04-2007 10:09 AM

He forgot a '.' :p
PHP Code:

$query $vbulletin->db->query_read("SELECT * FROM " TABLE_PREFIX "thread ORDER BY lastpost DESC LIMIT 10");

while (
$last $vbulletin->db->fetch_array($query))
{
// If you want to link to the thread to use $lasttitle .= '<a href="showthread.php?t='. $last['threadid'] .'">'. $last['title'] .'</a><br />';
$lasttitle .= $last['title']<br />;



amnesia623 09-04-2007 03:20 PM

AHH...thank you!

How would you go about coding this to follow forum permissions?

I really appreciate any help!

amnesia623 02-02-2008 04:44 PM

Does this still work in 3.7? I can't seem to get it to work...

mrkhm 04-12-2008 10:30 PM

thank you this works perfectly in vb 3.6.x

quick question for anyone is there anyway to limit it to only show titles from specific forums should i be doing

select * from where something something is = to something

thanks anyway

Opserty 04-13-2008 08:50 AM

Quote:

Originally Posted by mrkhm (Post 1489369)
thank you this works perfectly in vb 3.6.x

quick question for anyone is there anyway to limit it to only show titles from specific forums should i be doing

select * from where something something is = to something

thanks anyway

Change the MySQL query to:
[sql]
SELECT title, threadid FROM ". TABLE_PREFIX ."thread WHERE forumid IN (X, Y, Z) ORDER BY lastpost DESC LIMIT 10"[/sql]

Change [minicode]title, threadid[/minicode] to * if you want to select all fields.

X, Y, Z Being a comma separated list of the ForumID numbers.

mrkhm 06-27-2008 08:45 AM

ahhh! many thanks opserty! that works absolutely absolutely perfectly


All times are GMT. The time now is 11:18 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.01088 seconds
  • Memory Usage 1,737KB
  • 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_php_printable
  • (2)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