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

Reply
 
Thread Tools
News Out - posts from forum(s) on any page Details »»
News Out - posts from forum(s) on any page
Version: 1.00, by Rafe Rafe is offline
Developer Last Online: Mar 2011 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 05-13-2004 Last Update: Never Installs: 30
Is in Beta Stage  
No support by the author.

This script will let you pull the first posts from threads in a forum and display them on a non-vb page anywhere on your site.

For example you can use this to pull posts from a forum and display them as news. (Each post in the forum is a news item).

Currently it will pull them on the basis of thread start date.

This is very rough and ready. But maybe someone will find it useful.

If you read the code and comments you can do things like strip out tags, snip the post off after the first para etc etc.

You can choose to write out to a file or to write to screen. You can pull stuff from one or many forums.

I'll try and answer any questions that come up, but this is a beta so....

Rafe

Show Your Support

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

Comments
  #72  
Old 05-23-2005, 11:08 PM
greenhybrid greenhybrid is offline
 
Join Date: Jan 2005
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's what I was able to achieve with some creative modification of the code:
http://www.greenhybrid.com/
Reply With Quote
  #73  
Old 05-24-2005, 04:14 AM
AlexSFBay AlexSFBay is offline
 
Join Date: Jan 2004
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by greenhybrid
Here's what I was able to achieve with some creative modification of the code:
http://www.greenhybrid.com/
Nice work on the greenhybrid site! Would you mind sharing your PHP parse code -- I'm guessing you used preg_replace() -- to format the source link on the front page?
Reply With Quote
  #74  
Old 05-25-2005, 02:21 PM
Kei Kurono's Avatar
Kei Kurono Kei Kurono is offline
 
Join Date: Mar 2005
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i need to know the name of the table to extract the info.

How do i find out plz :]
Reply With Quote
  #75  
Old 05-26-2005, 12:19 AM
aspen0 aspen0 is offline
 
Join Date: Apr 2003
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm having a big bug with this hack.

Apparently calling global.php, as this hack does, is erasing all other variables in the php defined before it.

I've associated pages on my site with forums and have stored a forumid for each page in my db. I wanted to pull that forumid, pass it to this script, and have it print out topics.

However upon calling global.php the variable holding my forumid is erased. I don't know why, I can't explain it, but I tested it and its happening.

So, there is no way to dynamically feed this script information, for god knows what reason...
Reply With Quote
  #76  
Old 05-26-2005, 05:13 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is how global.php does work. It will reset all variables to protect against abuse.

Try to place global.php at the top of your script before you fill any other var's.
Reply With Quote
  #77  
Old 09-05-2005, 06:11 AM
AlexSFBay AlexSFBay is offline
 
Join Date: Jan 2004
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Quote: Originally Posted by greenhybrid
Here's what I was able to achieve with some creative modification of the code:
http://www.greenhybrid.com/

Nice work on the greenhybrid site! Would you mind sharing your PHP parse code -- I'm guessing you used preg_replace() -- to format the source link on the front page?
I figured it out... in case anybody was curious. See PHP function parse_url.

Code:
<?php
$myDomain = parse_url("http://www.yahoo.com/index.php#examples");
echo "Scheme: " . $myDomain["scheme"] . "<br>";
echo "Domain: " . $myDomain["host"] . "<br>";
echo "Path: " . $myDomain["path"] . "<br>";
echo "Anchor: " . $myDomain["fragment"] . "<br>";
?>
RESULT:
Scheme: http
Domain: www.yahoo.com
Path: /index.php
Anchor: examples


You can tweak it from there. Have fun!
Reply With Quote
  #78  
Old 09-07-2005, 09:47 PM
AlexSFBay AlexSFBay is offline
 
Join Date: Jan 2004
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by AlexSFBay
I figured it out... in case anybody was curious. See PHP function parse_url.

Code:
<?php
$myDomain = parse_url("http://www.yahoo.com/index.php#examples");
echo "Scheme: " . $myDomain["scheme"] . "<br>";
echo "Domain: " . $myDomain["host"] . "<br>";
echo "Path: " . $myDomain["path"] . "<br>";
echo "Anchor: " . $myDomain["fragment"] . "<br>";
?>
RESULT:
Scheme: http
Domain: www.yahoo.com
Path: /index.php
Anchor: examples


You can tweak it from there. Have fun!
I just realized there's more to the "Source" link function. Your script needs to be able to scan the text output and capture the URL. Anyone wanna take a stab on how to do that.
Reply With Quote
  #79  
Old 09-07-2005, 09:51 PM
AlexSFBay AlexSFBay is offline
 
Join Date: Jan 2004
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was also wondering how one can have an excerpted post for news threads that links back to your custom CMS page. See example in action here. (I figured out that this site is using the vBulletin-WordPress Bridge hack)
Reply With Quote
  #80  
Old 10-01-2005, 03:59 AM
joeMJ joeMJ is offline
 
Join Date: Feb 2005
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can anyone please help me with that problem?

I just upgraded to 3.5 (this script worked without any problems in 3.0.9 - sorry I know that it is not written for 3.5)

I'm getting mad because of no idea / brain on the bbcode parser.

Original does not work (in 3.5):
PHP Code:
require_once("./includes/functions_bbcodeparse.php");
$outxt=parse_bbcode2($ptext,"1","1","1","1","1"); 
prints now following error after upgrade to vb3.5
Code:
Fatal error: Call to a member function on a non-object in D:\server\mobilejoe\joeforums\includes\functions_bbcodeparse.php on line 398
This one looks better using old bbcode function but far away from how it should be (see screenshot below) because it still shows ****** bbcode. How can I fix this?
PHP Code:
require_once("./includes/functions_bbcodeparse.php");      
$outxt=parse_bbcode2($ptext,"1","1","","",""); 
oOoops - This thing does not exist in 3.5 - https://vborg.vbsupport.ru/showthread.php?t=82693 This is way to much for me.
Reply With Quote
  #81  
Old 10-02-2005, 04:09 AM
joeMJ joeMJ is offline
 
Join Date: Feb 2005
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oups?

Problem: You cannot use old parser, connect dies within script.

I finally got this to work. A friend of mine found out, that the db connect was broken and the new parser didn't work because of that issue. Here's what I did on my page to get this working in 3.5 including new Parser and Fix within db connect (including advertising after 3 news):

See this line:
$xdb = mysql_select_db("$dbname", $connection) or die ("Could not select database.");

PHP Code:
<?php
require_once("./global.php");
require_once(
'./includes/class_bbcode.php');

$splitval="lest mehr hier";
$cats="19"//"2,3,4,5,6";
$newsitems=10;
$forumspath="http://www.tralala.de/tralala";

$servername="localhost";
$dbusername="tralala";
$dbpassword="tralala";
$dbname="tralalatabelle";

//**************************************************************************************************************//

$iidx 0;

$bbparser =& new vB_BbCodeParser($vbulletinfetch_tag_list()); 

$connection mysql_connect("$servername","$dbusername","$dbpassword") or die ("Cannot connect to server.");
$xdb mysql_select_db("$dbname"$connection) or die ("Could not select database.");

$sql "SELECT threadid, title, forumid, replycount, postusername, postuserid, lastposter, dateline, iconid FROM thread WHERE forumid IN ($cats) AND sticky = '0' ORDER BY threadid DESC LIMIT $newsitems";
$sql_result mysql_query($sql$connection) or die ("Could not execute query.".mysql_error());

if (!
$sql_result
echo 
"Could not get news.";
else
{
 while (
$row mysql_fetch_array($sql_result)) 
 {
   
$threadid $row["threadid"];
   
$title $row["title"];
   
$forumid $row["forumid"];
   
$replycount $row["replycount"];
   
$postusername $row["postusername"];
   
$postuserid $row["postuserid"];
   
$lastposter $row["lastposter"];
   
$iconid $row["iconid"];
   
$dateline $row["dateline"];

   
$sql2 "SELECT postid, threadid, username, userid, title, dateline, pagetext, iconid FROM post WHERE threadid = \"$threadid\" ORDER BY postid ASC LIMIT 1";
   
$sql_result2 mysql_query($sql2$connection) or die ("Could not execute query in second sql statement.".mysql_error());

   if (!
$sql_result2
     echo 
"Could not get news.";
   else
   {
     while (
$row2 mysql_fetch_array($sql_result2)) 
     {
       
$ptext $row2["pagetext"];
       
$dateposted date("j.n.Y G:i",$dateline);
       
$commenttext "Kommentar";
       
       if( 
$replycount!=)
        
$commenttext .= "e";

       
$outxt=$bbparser->do_parse($ptexttruetruetruetruetruetrue);

       
$trimmed explode($splitval$outxt);
       
$outxt=$trimmed[0];

       
$sql3 "SELECT title FROM forum WHERE forumid = \"$forumid\" LIMIT 1";
       
$sql_result3 mysql_query($sql3$connection) or die ("Could not execute query in second sql statement.");
       
$row3 mysql_fetch_array($sql_result3);
       
$forumname $row3["title"];
      
       
$towrite .= "<div>$outxt</div>";

       
$towrite .= "<hr size='1'>";
       
       
$towrite .= "<div align='center'>";
       
$towrite .= "Geschrieben von <a href=\"$forumspath/member.php?s=&amp;action=getinfo&amp;userid=$postuserid\"><b>$postusername</b></a> am <i>$dateposted</i><br>";
       
$towrite .= "Kategorie: <a href=\"$forumspath/forumdisplay.php?s=&amp;forumid=$forumid\">$forumname</a><br>";
       
$towrite .= "<a href=\"$forumspath/showthread.php?s=&amp;threadid=$threadid\">$replycount $commenttext</a>";
       
$towrite .= "</div>";
       
       
$towrite .= "<hr size='1'>";

       if( 
$iidx++ % == )
         
$towrite .= "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#f7f7f7'><tr><td align='center'><iframe src='http://tralala.com/werbung.tralala' width='470' height='68' scrolling='no' marginheight='0' marginwidth='0' frameborder='0'></iframe></td></tr></table>";

       
$towrite .= "<hr size='1'>";

       
     }
   }
 }


echo 
$towrite;

?>
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:56 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.04716 seconds
  • Memory Usage 2,364KB
  • 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
  • (3)bbcode_code
  • (3)bbcode_php
  • (3)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
  • (3)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