Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by Imperitus (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 03-20-2001 Last Update: Never Installs: 0
 
No support by the author.

I was looking fro a news hack that would take the stories posted in a particular forum and rip them to post automaticly on my news page...

unfortunatly I haven't been able to find a simple script to do it that made sense to me. So I started looking into learning php and sql and making my own...

So here's the results so far:

--------

<html>
<head><title>News ripping script</title></head>
<body>

<?
/* declare some relevant variables */
$DBhost = "your server name or ip";
$DBuser = "the user name for the server";
$DBpass = "the pass word for the server";
$DBName = " the name of the database you're useing for vbulletin";
$DBTable = "thread";
$DBForum = "The number of the forum you want to use to post news";

mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$sqlquery = "SELECT * FROM $DBTable WHERE forumid = $DBForum ORDER by dateline DESC";
$result = mysql_query($sqlquery);
$number = mysql_numrows($result);

$i = 0;

if ($number < 1) {
print "<CENTER><P>There Were No Results for Your Search</CENTER>";
}
else {
while ($number > $i) {
$thename = mysql_result($result,$i,"title");
$theid = mysql_result($result,$i,"threadid");
$name = mysql_result($result,$i,"postusername");


print "<p><A href=forums/showthread.php?threadid=$theid>$thename</a> <br>posted by: $name


";
$i++;
}
}
?>
</BODY></HTML>

--------

I then call it with the tag:

<?php include('news.php');?>

Pretty simple, and not too functional but it works and is easy to understand for a novice like me.

I'm going to try and get it to pull the content of the posts as well next... any comments?

Show Your Support

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

Comments
  #2  
Old 03-20-2001, 05:50 PM
Guest
 
Posts: n/a
Default

It has already been done...do a search for BFC_Weblog
Reply With Quote
  #3  
Old 03-20-2001, 06:04 PM
Guest
 
Posts: n/a
Default

It was my understanding that that script was for the old vbulletin and that the new version vbshell or whatever was over kill for my simple needs... Maybe I'm wrong.
Reply With Quote
  #4  
Old 03-20-2001, 07:29 PM
Guest
 
Posts: n/a
Default

If you search my posts on here you will find the first version of a script I wrote to do this using the features already in the vB code.

I have made quite a few improvments since then though, ie headlines, dailly top posters, polls... This will be a part of my complete site integration package I am writing for my site http://www.ravingaming.com. I will be releasing this code when it reaches a stage that I won't have to spend a lot of time supporting the code. But if you don't want to wait that long...

I suggest you first read through the /global.php, /admin/global.php, /admin/db_mysql.php, /functions.php and anything that is included in a good part of the files. If you include the /global.php you can do a lot more with your script, online users and the like. Plus you can use the class that is already written for interaction with the MySQL DB.
Reply With Quote
  #5  
Old 03-20-2001, 07:37 PM
Guest
 
Posts: n/a
Default

Thanks for the tip. Yours was actualyt he script I was hoping to use... but my friends and I who are working on the site this is foar are impatient.

It's possible you're sill come out before I complet emine and I'll still use yours...

But in the mean time I'm using this project to learn php and sql... which I have never worked with before.
Reply With Quote
  #6  
Old 03-20-2001, 08:07 PM
Guest
 
Posts: n/a
Default

Thanks for the news hack

Imperitus
Reply With Quote
  #7  
Old 03-20-2001, 08:21 PM
Guest
 
Posts: n/a
Default

You're very welcome.
Reply With Quote
  #8  
Old 03-20-2001, 11:04 PM
Guest
 
Posts: n/a
Default

I now have it working with the actual story content and posting the date as well. It is still just the one php file and a call from another page (if you want..) Yeha! Took me two days to hack together from not knowing any php or sql... god I like php... It's so easy. ( realativly)

You will probably want to edit the way it displays the ripped stories, that's easy enough if you are carefull and just play in the print output...

Remember if you want you can turn on html in the forum you are using and then post pictures etc... I sugest making that forum require moderator authorization if you use this though, to prevent peopel from posting things that would mess up your board.


Here's the final version: I'll call it VBul News Ripper 1.0

<?
/* declare some relevant variables */

$DBhost = "your server name or ip";
$DBuser = "the user name for the server";
$DBpass = "the pass word for the server";
$DBName = " the name of the database you're useing for vbulletin";
$DBForum = "The number of the forum you want to use to post news";
$DBLimit = "The number or stories to rip";
$DBLink = "Path to your showthread exp: forums/showthread.php?threadid";

/* don't mess with this one it should be the same for all vbulletins */

$DBTable = "thread";

/* do some story ripping... */

mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to database");
mysql_select_db("$DBName") or die("Unable to access the News");
$sqlquery = "SELECT * FROM $DBTable WHERE forumid = $DBForum ORDER by dateline DESC LIMIT 0,$DBLimit";
$result = mysql_query($sqlquery);
$number = mysql_numrows($result);

$i = 0;

if ($number < 1) {
print "<CENTER><P>There Is NO News!</CENTER>";
}
else {
while ($number > $i) {
$title = mysql_result($result,$i,"title");
$theid = mysql_result($result,$i,"threadid");
$name = mysql_result($result,$i,"postusername");
$time = mysql_result($result,$i,"dateline");
$time2 = unixtojd($time);
$time3 = jdtogregorian($time2);
$storyquery = "SELECT pagetext FROM post where threadid = $theid order by dateline limit 0,1";
$storyres = mysql_query("$storyquery");
$story = mysql_result($storyres,"pagetext");


print "<p>Title: <A href=$DBLink=$theid>$title</a> <br>Story: $story <br>posted by: $name <br>posted on: $time3

";
$i++;
}
}

?>
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 11:36 AM.


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.05050 seconds
  • Memory Usage 2,255KB
  • Queries Executed 23 (?)
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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (8)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_postinfo_query
  • fetch_postinfo
  • 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
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete