vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   RSS feed hack (https://vborg.vbsupport.ru/showthread.php?t=6490)

01-06-2001 11:57 PM

Hello everyone,

I built a PHP RSS library to include headlines from popular website into my homepage, it worked great and I used it to include my favourite sites slashdot, linuxtoday, and freshmeat of course ;)

but I needed to add my favourite bulletin board site that uses VB, and I searched for RSS support in VB, but I didn't find any, so I downloaded the lite version of VB and installed it, and after 3 hours I have my RSS hack for VB, and it works great, I tested it for the full version and it works fine there :)

I thought someone might be intersted on it, here is the code, it is a stripped down "forumdisplay.php" file with little changes to make it produce RSS file.
Put it in the same directory with "forumdisplay.php", and you call it in the same way "rss.php?forumid=1"

Hope you like it and use it :)

Code:

<?php echo '<?xml version="1.0"?>'; ?>

<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
            "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">

  <channel>

<?php

echo "<!--\n";
require("global.php");
echo "-->\n";

        echo "<title>$bbtitle</title>\n";
        echo "<link>$bburl</link>\n";

// set defaults
if (isset($perpage)==0 or $perpage==0) {
  $perpage=$maxthreads;
}

$forumid = verifyid("forum",$forumid);


$foruminfo=$DB_site->query_first("SELECT title,description,active FROM forum WHERE forumid=$forumid");
$forumtitle=htmlspecialchars($foruminfo[title]);
if ($foruminfo[active]==0) {
  echo "<item><title>Forum Not Active</title></item></channel></rss>";
  exit;
}

$description=htmlspecialchars($foruminfo[description]);
$forumtitle=htmlspecialchars($foruminfo[title]);

$threads=$DB_site->query("SELECT threadid,title,lastpost,replycount,postusername FROM thread WHERE forumid=$forumid ORDER BY lastpost DESC LIMIT 0,$perpage");
while ($thread=$DB_site->fetch_array($threads)) {

  $threadtitle=htmlspecialchars($thread[title]);
  $threadid=$thread[threadid];

  $notes=htmlspecialchars($thread[notes]);
  $replies=$thread[replycount];
  $firstposter=htmlspecialchars($thread[postusername]);
  $lastreplydate=date($dateformat,$thread[lastpost]+($timeoffset*3600));
  $lastreplytime=date($timeformat,$thread[lastpost]+($timeoffset*3600));

 echo "<item>\n";
 echo "<title>$threadtitle</title>\n";
 echo "<link>". $bburl ."/showthread.php?threadid=$threadid</link>\n";
 echo "<description> $firstposter - $replies - $lastreplytime </description>\n";
 echo "</item>\n";

}

?>

  </channel>

</rss>


01-07-2001 12:06 PM

do you have a sample of your site ?

01-07-2001 05:27 PM

<a href="http://www.rayed.f2s.com/vb/rss.php?forumid=1" target="_blank">http://www.rayed.f2s.com/vb/rss.php?forumid=1</a>

of course it won't show anything, you have to save it and view it with normal editor.
the server is free server that a use for testing, sometimes it get very very slow.

01-07-2001 05:49 PM

yeah freedom2surf really do my head in with the slowness.

X-Fan 04-01-2003 01:34 PM

Is there any way to have this hack auto-generate a new RSS file for specified forums at the end of each day?

And how can someone display these news feeds on their Web sites, or via a ticker? I'd like to offer an "easy set-up" mehod for people to syndicate my site's news.


All times are GMT. The time now is 01:10 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.01023 seconds
  • Memory Usage 1,723KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete