Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Last X Posts Titles on Non-VB page Details »»
Last X Posts Titles on Non-VB page
Version: 1.00, by RobinHood RobinHood is offline
Developer Last Online: Mar 2007 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 03-17-2004 Last Update: Never Installs: 92
 
No support by the author.

Hi everyone,

Well, here is my first full release to the vB.org community. It's a small little script I just whipped up a few minutes ago. I already have this on my webpage for months now and thought I'd share it with the rest of you.

Description:
This script will display the titles, poster's names, and times of the last X's posts. It's fully customizable. Should be very easy to understand so enjoy!

Instructions:
1) Download the script below.
2) Change the settings in the script.
3) Insert include("/path/to/lastposts3.php"); anywhere in a non-VB page.

If you like to check out a live demo, you may go visit one of my sites: http://www.generazn.com.

If you have any problems, questions, or comments regarding this, feel free to post them here or send me an email to tre@phase1media.com.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #52  
Old 09-09-2004, 06:23 PM
TheClassic TheClassic is offline
 
Join Date: Sep 2004
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by JohnK
If someone has the time and inclination to sort out the server time vs forum time issue that would be even better
I'll take a look at this, no promises.

To do this, I need to know what the forum timezone is, any clues on where that is in the DB?
Reply With Quote
  #53  
Old 09-13-2004, 06:49 AM
dfmafia dfmafia is offline
 
Join Date: Jul 2002
Location: Wherever Uncle Sam Needs
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what version of vB3 is it working on and which versions does it not work on

im using vB 3.0.3 and it dont work
Reply With Quote
  #54  
Old 09-13-2004, 07:11 AM
dfmafia dfmafia is offline
 
Join Date: Jul 2002
Location: Wherever Uncle Sam Needs
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well looky there...

at:
PHP Code:
$forum_id "3"// If you wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank. 
it will only work out correctly if u input 1 forum_id - when i entered in only the forums i wanted t show up (about 20 of them) i get:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/lastposts3.php on line 48

if i just enter in 1 forum id it works great

this is fior both the scripts the author made

lastposts3.php and lastthreads3.php
Reply With Quote
  #55  
Old 09-13-2004, 10:24 AM
JohnK JohnK is offline
 
Join Date: Nov 2001
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I haven't used $forum_id but I have used $excludeforums successfully which could give you the same result in the end. A list of forum numbers separated by commas works here.

John
Reply With Quote
  #56  
Old 09-17-2004, 06:01 PM
3dfly's Avatar
3dfly 3dfly is offline
 
Join Date: May 2002
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is it possible to show Thumbnail from post ?
Reply With Quote
  #57  
Old 09-22-2004, 06:09 PM
nhatrang nhatrang is offline
 
Join Date: Jun 2004
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

any chance we can display the posts under the thread title as well too?
Reply With Quote
  #58  
Old 10-04-2004, 05:09 PM
WoodiE WoodiE is offline
 
Join Date: May 2002
Posts: 317
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does anyone know how to convert the output of this script to valid XHTML code?

-Michael
Reply With Quote
  #59  
Old 03-29-2005, 08:31 AM
therczone therczone is offline
 
Join Date: Sep 2003
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I want to start off by saying I take no credit for this code. I simply found a easy bug.

https://vborg.vbsupport.ru/showthread.php?t=62624
https://vborg.vbsupport.ru/showpost....2&postcount=38

I have been looking for a "Racent Topics" script to pull 10-15 of the latest threads onto a non-vB page. Well I almost gave up, but decided to give RobinHood's code one last try.

The error that you receive is:

Quote:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/lastposts3.php on line 48
The reason being that the prefix for the tables has to be manually added.

Original:

Code:
<?php 

#########################
## LAST X POSTS v3.1   ##
## PHASE(1) MEDIA      ##
## WWW.PHASE1MEDIA.COM ##
## TRE@PHASE1MEDIA.COM ##
#########################

/* This script shows the last X numbers of posts (titles) posted last on a non-VB page.
You may customize it in any way you wish. If you have any problems with it, you can
post them at vB.org or send me an email to tre@phase1media.com.

Enjoy!
*/

## CUSTOMIZE SETTINGS FOR YOUR SITE ##
$db_host = "localhost"; // Change this if your MySQL database host is different.
$db_name = "vbulletin"; // Change this to the name of your database.
$db_user = "user"; // Change this to your database username.
$db_pw = "password"; // Change this to your database password.

$forum_url = "http://www.yourdomain.com/forum"; // Change this to reflect to your forum's URL.
$forum_id = ""; // If you wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank.
$limit = "10"; // Number of posts displayed.
$titlecolor = "#0000FF"; // This is the color of the title.
$postedcolor = "#404040"; // This is the color of the bottom text.
$txtlimit = "100"; // This is the character limit.
#######################################

// Connecting to your database
mysql_connect($db_host, $db_user, $db_pw) 
OR die ("Cannot connect to your database"); 
mysql_select_db($db_name) OR die("Cannot connect to your database"); 

// Below is the beginning of a table. If you feel you don't need it, you may remove it.
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";

if ($forum_id) {
	$forumid = "AND forumid=$forum_id";
}

if ($limit) {
	$limited = "LIMIT $limit";
}
$thread_sql = mysql_query("SELECT threadid,title,lastpost,lastposter FROM thread WHERE visible=1 AND open=1 $forumid ORDER BY lastpost DESC $limited");

while($thread_get=mysql_fetch_array($thread_sql))
{
$lastpost = $thread_get['lastpost'];
$poster = $thread_get['lastposter'];
$tid = $thread_get['threadid'];
$psql = mysql_query("SELECT postid FROM post WHERE threadid=$tid ORDER BY postid DESC");
$getp=mysql_fetch_array($psql);
$pid = $getp['postid'];
$date2 = date ("m/d/y h:i A" ,$lastpost);
$title = $thread_get['title'];
$title = substr($title,0,$txtlimit);
echo "<tr><td><font size=\"2\" face=\"arial,verdana,geneva\"><a href=\"$forum_url/showthread.php?p=$pid#post$pid\"><FONT SIZE=\"2\" COLOR=\"$titlecolor\" face=\"arial,verdana,geneva\">$title</FONT></a></font><br /><font color=\"$postedcolor\" face=\"arial,verdana,geneva\" size='1'>posted by $poster <i>$date2</i></FONT></td></tr>";
}
echo "</table>";

?>
Correct (for vB3.0.7):

Code:
<?php 

#########################
## LAST X POSTS v3.1   ##
## PHASE(1) MEDIA      ##
## WWW.PHASE1MEDIA.COM ##
## TRE@PHASE1MEDIA.COM ##
#########################

/* This script shows the last X numbers of posts (titles) posted last on a non-VB page.
You may customize it in any way you wish. If you have any problems with it, you can
post them at vB.org or send me an email to tre@phase1media.com.

Enjoy!
*/

## CUSTOMIZE SETTINGS FOR YOUR SITE ##
$db_host = "localhost"; // Change this if your MySQL database host is different.
$db_name = "vbulletin"; // Change this to the name of your database.
$db_user = "user"; // Change this to your database username.
$db_pw = "password"; // Change this to your database password.

$forum_url = "http://www.yourdomain.com/forum"; // Change this to reflect to your forum's URL.
$forum_id = ""; // If you wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank.
$limit = "10"; // Number of posts displayed.
$titlecolor = "#0000FF"; // This is the color of the title.
$postedcolor = "#404040"; // This is the color of the bottom text.
$txtlimit = "100"; // This is the character limit.
#######################################

// Connecting to your database
mysql_connect($db_host, $db_user, $db_pw) 
OR die ("Cannot connect to your database"); 
mysql_select_db($db_name) OR die("Cannot connect to your database"); 

// Below is the beginning of a table. If you feel you don't need it, you may remove it.
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";

if ($forum_id) {
	$forumid = "AND forumid=$forum_id";
}

if ($limit) {
	$limited = "LIMIT $limit";
}
$thread_sql = mysql_query("SELECT threadid,title,lastpost,lastposter FROM YOURPREFIXHERE_thread WHERE visible=1 AND open=1 $forumid ORDER BY lastpost DESC $limited");

while($thread_get=mysql_fetch_array($thread_sql))
{
$lastpost = $thread_get['lastpost'];
$poster = $thread_get['lastposter'];
$tid = $thread_get['threadid'];
$psql = mysql_query("SELECT postid FROM YOURPREFIXHERE_post WHERE threadid=$tid ORDER BY postid DESC");
$getp=mysql_fetch_array($psql);
$pid = $getp['postid'];
$date2 = date ("m/d/y h:i A" ,$lastpost);
$title = $thread_get['title'];
$title = substr($title,0,$txtlimit);
echo "<tr><td><font size=\"2\" face=\"arial,verdana,geneva\"><a href=\"$forum_url/showthread.php?p=$pid#post$pid\"><FONT SIZE=\"2\" COLOR=\"$titlecolor\" face=\"arial,verdana,geneva\">$title</FONT></a></font><br /><font color=\"$postedcolor\" face=\"arial,verdana,geneva\" size='1'>posted by $poster <i>$date2</i></FONT></td></tr>";
}
echo "</table>";

?>
Simple diagnostics:

$thread_sql = mysql_query("SELECT threadid,title,lastpost,lastposter FROM YOURPREFIXHERE_thread WHERE visible=1 AND open=1 $forumid ORDER BY lastpost DESC $limited");

while($thread_get=mysql_fetch_array($thread_sql))
{
$lastpost = $thread_get['lastpost'];
$poster = $thread_get['lastposter'];
$tid = $thread_get['threadid'];
$psql = mysql_query("SELECT postid FROM YOURPREFIXHERE_post WHERE threadid=$tid ORDER BY postid DESC");
Reply With Quote
  #60  
Old 03-29-2005, 08:40 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yup if you don't include the global.php then it has no way of knowing what "TABLE_PREFIX" means.
Reply With Quote
  #61  
Old 03-29-2005, 08:42 AM
therczone therczone is offline
 
Join Date: Sep 2003
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Even if it was included, the table prefix snippet of code is not in this code.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:23 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04710 seconds
  • Memory Usage 2,319KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete