Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
LBmtb's Recent Topics on Non-VB Pages Details »»
LBmtb's Recent Topics on Non-VB Pages
Version: 1.03, by LBmtb LBmtb is offline
Developer Last Online: Aug 2015 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 3.6.4 Rating:
Released: 12-18-2006 Last Update: 03-26-2007 Installs: 64
 
No support by the author.

RECENT TOPICS by LBmtb
Version 1.03
Last updated: March 27th, 2007

DESCRIPTION
This script will display the topics with the most recent posts on a non-vb page (any HTML page). The page it's on must have a .php extension or you should setup apache to parse the page correctly. The threads with the latest posts are on top. The output is a clean list in this format:

HTML Code:
<ul class="vb_topics">
<li><a href="http://www.yourdomain.com/forum/showthread.php?t=4150">This is the latest thread</a> <span class="vb_last_post">(user1 @ 12/18/06 05:58 PM)</span></li>
<li><a href="http://www.yourdomain.com/forum/showthread.php?t=4138">Another recent thread</a> <span class="vb_last_post">(user2 @ 12/18/06 05:58 PM)</span></li>
</ul>
Customizable options include:
  • forum ID - choose to only include or exclude certain forums
  • number of topics displayed
  • CSS class names for the topic name/url and last poster/date
  • and a few others
COPYRIGHT
There is a copyright line. I am releasing this script on the condition that you do not remove this line unless you send $5 via paypal to webmaster@socaltrailriders.org. Thanks in advance for understanding.

NEED CUSTOMIZATION OR PROFESSIONAL INSTALLATION?
Email me at webmaster@socaltrailriders.org, PM me on vbulletin.org, or aim me at "lbmtb" to inquire about customizing this script or installation.

REVISION HISTORY
Version 1.03: Adds small preview of first post when the user rolls over the links
Version 1.02: option to exclude certain forums
Version 1.01: option to only include certain forums
Version 1.0: Initial Release

INSTRUCTIONS:
1) Copy and paste the following code where you want the list to appear and adjust the values in the section "CUSTOMIZE THE FOLLOWING":

PHP Code:
<?php 
##########################################################################
// RECENT TOPICS by LBmtb
// Version 1.03
// webmaster@socaltrailriders.org OR aim: LBmtb
//
// Do not remove copyright unless you donate $5 via paypal
// to the above email address, thanks
// CUSTOMIZED from a www.phase1media.com script found here:
// https://vborg.vbsupport.ru/showpost.php?p=589067&postcount=7
##########################################################################

## CUSTOMIZE THE FOLLOWING    ##############################################

// DATABASE & URL SETTINGS
$db_host "localhost"// Change this if your MySQL database host is different.
$db_name "db_name"// Change this to the name of your database.
$db_user "db_username"// Change this to your database username.
$db_pw "db_password"// Change this to your database password.
$db_prefix "vb_"// Change to your tables' prefix. Usually vb_
$forum_url "http://www.yourdomain.com/forum"// Change this to reflect to your forum's URL.

// APEARANCE OPTIONS
$seperator "@"// this goes between last poster and date
$limit "10"// Number of posts displayed
$post_date_format "1"// leave as 1 for "12/18/06 05:26 PM" or change to 2 for "05:26 PM"

// use one or the other, not both. if left blank the script will return threads from any forum
$fid_raw ""// ONLY include threads from these forums. seperate each ID with a comma
$fidx_raw ""// Exclude threads from these forum. seperate each ID with a comma

// CSS CLASSES    
$recent_topics "vb_topics"// you can use CSS to adjust the presentation of the list 
$recent_poster "vb_last_post";  // you can use CSS to adjust the presentation the last poster and date

## NO NEED TO TOUCH ANYTHING BELOW    #####################################
#############################################################################

if (!($recent_topics_connection mysql_connect("$db_host""$db_user""$db_pw")))
die (
"could not connect"); 
if (!(
mysql_select_db("$db_name"$recent_topics_connection)))
mysql_error(); 
echo 
"<ul class=\"$recent_topics\">\n";
$fid_array explode (','$fid_raw);
if (
$fid_raw)  {
    
$fid_final .= "AND (";
    foreach( 
$fid_array as $key => $value){
        if (
$key == 0) { $fid_final .= "t.forumid=".$value; }
        else { 
$fid_final .= " OR t.forumid=".$value; }
    }
    
$fid_final .= ")";
}
$fidx_array explode (','$fidx_raw);
if (
$fidx_raw)  {
    
$fidx_final .= "AND NOT (";
    foreach( 
$fidx_array as $key => $value){
        if (
$key == 0) { $fidx_final .= "t.forumid=".$value; }
        else { 
$fidx_final .= " OR t.forumid=".$value; }
    }
    
$fidx_final .= ")";
}
$thread_sql mysql_query("SELECT SQL_CACHE t.threadid,t.title,t.lastpost,t.lastposter,t.forumid,substring(p.pagetext,1,90) as post_text
    FROM "
.$GLOBALS['db_prefix']."thread t
    INNER JOIN "
.$GLOBALS['db_prefix']."post p
    ON t.firstpostid = p.postid
    WHERE t.visible=1 
    AND t.open=1 
$fidi_final $fidx_final 
    ORDER BY t.lastpost desc 
    LIMIT 
$limit");
while(
$thread_get=@mysql_fetch_array($thread_sql))
{
    
$lastpost $thread_get['lastpost'];
    
$poster $thread_get['lastposter'];
    
$tid $thread_get['threadid'];
$text $thread_get['post_text'];
    if (
$post_date_format == "1") { $date2 date ("m/d/y h:i A" ,$lastpost); }
    elseif (
$post_date_format == "2") { $date2 date ("h:i A" ,$lastpost); }
    else { 
$date2 date ("m/d/y h:i A" ,$lastpost); }
        echo 
"<li><a href=\"$forum_url/showthread.php?t=$tid\" title=\"".$text."\">$thread_get[title]</a> <span class=\"$recent_poster\">($poster $seperator $date2)</span></li>\n";
}
echo 
"</ul>\n<div style=\"font-size: .9em;\">recent topics by <a href=\"http://www.socaltrailriders.org/\"><acronym title=\"Southern California Trail Riders\">SocalTrailRiders.org</acronym></a></div>";
mysql_close($recent_topics_connection);
?>
2) Go back to the vbulletin.org thread where you found this and click on "Mark as Installed"
3) Enjoy!
4) Donate (this step optional)


UPGRADE INSTRUCTIONS (from 1.02 to 1.03):


FIND:
Code:
$thread_sql = mysql_query("SELECT threadid,title,lastpost,lastposter FROM ".$db_prefix."thread WHERE visible=1 AND open=1 $fid_final $fidx_final ORDER BY lastpost desc LIMIT $limit");
REPLACE WITH:
Code:
$thread_sql = mysql_query("SELECT SQL_CACHE t.threadid,t.title,t.lastpost,t.lastposter,t.forumid,substring(p.pagetext,1,90) as post_text
    FROM ".$GLOBALS['db_prefix']."thread t
    INNER JOIN ".$GLOBALS['db_prefix']."post p
    ON t.firstpostid = p.postid
    WHERE t.visible=1 
    AND t.open=1 $fidi_final $fidx_final 
    ORDER BY t.lastpost desc 
    LIMIT $limit");
FIND:
Code:
    $tid = $thread_get['threadid'];
AFTER, ADD:
Code:
    $text = $thread_get['post_text'];
FIND AND REPLACE:
Code:
forumid=".$value
WITH:
Code:
t.forumid=".$value
FIND:
Code:
    echo "<li><a href=\"$forum_url/showthread.php?t=$tid\">$thread_get[title]</a> <span class=\"$recent_poster\">($poster $seperator $date2)</span></li>\n";
REPLACE WITH:
Code:
    echo "<li><a href=\"$forum_url/showthread.php?t=$tid\" title=\"".$text."\">$thread_get[title]</a> <span class=\"$recent_poster\">($poster $seperator $date2)</span></li>\n";


UPGRADE INSTRUCTIONS (from 1.01 to 1.02):

FIND:
PHP Code:
// APEARANCE OPTIONS
$seperator "@"// this goes between last poster and date
$fid_raw ""// If you want to restrict to specific forums, enter the forum id(s) here. seperate them with a comma. Otherwise, leave it blank.
$limit "10"// Number of posts displayed
$post_date_format "1"// leave as 1 for "12/18/06 05:26 PM" or change to 2 for "05:26 PM" 
REPLACE WITH:
PHP Code:
// APEARANCE OPTIONS
$seperator "@"// this goes between last poster and date
$limit "10"// Number of posts displayed
$post_date_format "1"// leave as 1 for "12/18/06 05:26 PM" or change to 2 for "05:26 PM"

// use one or the other, not both. if left blank the script will return threads from any forum
$fid_raw ""// ONLY include threads from these forums. seperate each ID with a comma
$fidx_raw ""// Exclude threads from these forum. seperate each ID with a comma 
REPLACE EVERYTHING BELOW:
PHP Code:
## NO NEED TO TOUCH ANYTHING BELOW    ######################################
########################################################################## 
With everything below that same line in 1.02

NOTES:
This is my first mod/script so be nice, please

DEMO:
http://www.socaltrailriders.org/latest_posts.php

Supporters / CoAuthors

Show Your Support

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

Comments
  #42  
Old 02-06-2007, 04:35 AM
LBmtb LBmtb is offline
 
Join Date: Jan 2006
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First of all, thanks to everyone for their interest in this mod.
Quote:
Originally Posted by tonynlek View Post
LBmtb,

I need help to install it and i dunno much about PHP. care to guide me along or anyone.

I do not know how to do this part:
<< The page it's on must have a .php extension or you should setup apache to parse the page correctly. >>

What must i do first?
You can either rename the page with a .php extension or if your page has a .html or .htm extension add the following to your apache configuration file and restart apache:
Code:
AddType application/x-httpd-php .html .htm

Quote:
Originally Posted by saman View Post
facing the same problem

right now i have added it on .html extension and the only thing it shows is this:

recent topics by SocalTrailRiders.org

can someone help me out with this? i really like this mod, i am testing it and if he works i will need to get the copyright removed ($5)...

btw, where should i add this html code?

HTML Code:
<ul class="vb_topics">
<li><a href="http://www.yourdomain.com/forum/showthread.php?t=4150">This is the latest thread</a> <span class="vb_last_post">(user1 @ 12/18/06 05:58 PM)</span></li>
<li><a href="http://www.yourdomain.com/forum/showthread.php?t=4138">Another recent thread</a> <span class="vb_last_post">(user2 @ 12/18/06 05:58 PM)</span></li>
</ul>
Same answer as previous person. Don't insert that html code into your page; it's just an example of the output that the script makes.

Quote:
Originally Posted by tonynlek View Post
As far as i know, You need to create an inframe in HTml page to put in the site address of that PHP file and it will open in the inframe.

I hate the borderline of the inframe, so my homepage has to be index.php, in order to put the code without the inframe border.

a programmer that i paid, told me this. I wonder why the script creator dun reply.
That would work, or the apache method I described above, or adding the .php extension like you did.

Quote:
Originally Posted by tonynlek View Post
How do you put the ID there?
Just list off the forum ID's and separate them with a comma. For example if I want to only include threads from three forums with ID's 9, 11, and 15 I would have this:
PHP Code:
// use one or the other, not both. if left blank the script will return threads from any forum
$fid_raw "9,11,15"// ONLY include threads from these forums. seperate each ID with a comma
$fidx_raw ""// Exclude threads from these forum. seperate each ID with a comma 
Quote:
Originally Posted by Dave-ahfb View Post
I am attempting to install this and it does works as designed, however I am trying to include multiple instances of the script on the same page, each instance using a different forum./

example:

top of page use only forum 14
middle of page use only forum 13

yadda yadda

I can include multiple instances of the same forum meaning I can place forum 14 in as many places of a page as I want, but I cannot get a second forum to show in a different location of the page.
It's possible but you would need to do some renaming of copying and renaming of variables so that variables from one of the sections don't conflict with variables from the other section.

If you need custom work done, PM me.
Reply With Quote
  #43  
Old 02-06-2007, 11:41 PM
tonynlek tonynlek is offline
 
Join Date: Jun 2006
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
You can either rename the page with a .php extension or if your page has a .html or .htm extension add the following to your apache configuration file and restart apache:
Hi LBmtb,

Thanks for your reply. BY the way, where is the apache config file. ANd which part of the page should i put the code in. I am sorry to ask you this question as programming is out of my league. Learning now.
Reply With Quote
  #44  
Old 02-07-2007, 06:42 PM
LBmtb LBmtb is offline
 
Join Date: Jan 2006
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tonynlek View Post
Hi LBmtb,

Thanks for your reply. BY the way, where is the apache config file. ANd which part of the page should i put the code in. I am sorry to ask you this question as programming is out of my league. Learning now.
I found a good tutorial on it: http://www.adlogger.org/index.php/Pa...Pages_Like_PHP
Reply With Quote
  #45  
Old 02-13-2007, 04:25 PM
Tomzl Tomzl is offline
 
Join Date: Jan 2006
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there a way to trim the number of characters in the topic title? For example: a topic has 50 characters in its title. Can I show just 25 characters with this script?
Reply With Quote
  #46  
Old 02-15-2007, 01:27 PM
roni1015 roni1015 is offline
 
Join Date: Dec 2005
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm trying to rescrict this to only public forums and it's still showing threads from all forums.

Here is the code I have:

Code:
// use one or the other, not both. if left blank the script will return threads from any forum
$fid_raw = "99,3,119,134"; // ONLY include threads from these forums. seperate each ID with a comma
$fidx_raw = ""; // Exclude threads from these forum. seperate each ID with a comma
I also tried doing it by excluding certain forums instead and removed the ones to include and then added the ones to exclude below, but it didn't work either. What am I doing wrong?
Reply With Quote
  #47  
Old 02-15-2007, 04:47 PM
pcoskat pcoskat is offline
 
Join Date: Apr 2002
Location: atlanta
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

LBmtb, is your 'upcoming events' list using the EVENTS mod, or is your mod using a feed directly from the calendar?
Reply With Quote
  #48  
Old 02-17-2007, 04:16 PM
roni1015 roni1015 is offline
 
Join Date: Dec 2005
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by roni1015 View Post
I'm trying to rescrict this to only public forums and it's still showing threads from all forums.

Here is the code I have:

Code:
// use one or the other, not both. if left blank the script will return threads from any forum
$fid_raw = "99,3,119,134"; // ONLY include threads from these forums. seperate each ID with a comma
$fidx_raw = ""; // Exclude threads from these forum. seperate each ID with a comma
I also tried doing it by excluding certain forums instead and removed the ones to include and then added the ones to exclude below, but it didn't work either. What am I doing wrong?
Anyone?
Reply With Quote
  #49  
Old 02-19-2007, 05:59 PM
superluks superluks is offline
 
Join Date: Jan 2007
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i wanna add it to header - i added this code
PHP Code:
<?php include("last.php"); ?>
but it wont content..
Reply With Quote
  #50  
Old 03-03-2007, 01:20 AM
Dave-ahfb Dave-ahfb is offline
 
Join Date: Mar 2002
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there a way to limit the text string? I have small "modules" and some times they wrap 3 times.
Reply With Quote
  #51  
Old 03-16-2007, 04:52 AM
ricker ricker is offline
 
Join Date: Jun 2003
Location: Apple Valley, CA
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This may be a long shot, but I'm using extra threadfields and am wondering if it'd be easy to include a field or two in the display. Thanks for the great mod!!!
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 12:13 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.10089 seconds
  • Memory Usage 2,382KB
  • Queries Executed 26 (?)
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
  • (11)bbcode_code
  • (1)bbcode_html
  • (6)bbcode_php
  • (8)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