Posted on: 03/09/03 10:54pm
By: scroff
I'm looking to see if anyone has created a static page that uses various newsfeeds as the story. I'd like to have three or four different feeds on a page by themselves. I know you can use php on static pages, but I don't know hwo to do that. If anyone has done it or can tell me how real quick I'd really appreciate it.
static page news feed
Posted on: 03/09/03 11:55pm
By: squatty
TomW created a page that displays multiple RSS feeds in a single page.
There is one trick to getting it running. All the news feeds you will use (you can see how to set them up at the top of the file), have to be created as blocks. If you are not going to display them (why would you do both) just disable them. The page then uses the normal geeklog rdf code to get the news feeds and display them.
One thing that you can also do is add a cron job using lynx to fetch the page every so often. That will make the display for the user faster because if no one has looked at the page for an hour (or whatever you have your interval set at) then refreshing 6 news feeds will make you think the site is down.
You can see this page in action here[*1] . The download is here[*2] .
---
Danny @ squatty.com
static page news feed
Posted on: 03/11/03 08:22am
By: geKow
Hey, you might me interesteted in that script, a friend of mine wrote:
http://jaykul.fragmentized.com/scripting/news_feed_parser.php
(instructions on that page)
I tried it on my geeklog and it worked quite well, also with multiple feeds. The only problem I have is that the php happens above the static page headline
static page news feed
Posted on: 03/12/03 02:36am
By: scroff
Thanks Danny, this is exactly what I had in mind. I'm a real newb at this and thought Lynx was a cheap car, so this looks like it'll have to do the trick until I learn alot more. Thanks. I only have about three or four feeds I want to use. Thanks Thanks thanks again!
Scroff
static page news feed
Posted on: 03/15/03 01:56pm
By: rei
Here's the script I use with StaticPages 1.2. It is a modified version of the TomW/Squatty code:
-Rei
-----------
//
// PHP Snippet for Geeklog StaticPages 1.2 to display RDF Headlines.
// Thx to TomW/Squatty for original codebase.
// Modification by Rei Yoshioka (rei@yoshioka.com)
//
// INSTRUCTIONS:
//
// Install the StaticPages 1.2 which allows PHP content on static pages.
// Configure RDF Portal Blocks and reference them below by block name.
// Cut and paste this code into a PHP-enabled static page.
// The only thing you should need to change is the list of feeds.
//
//
// CONFIG:
//
// These are names of the GeekLog RDF Portal Block feeds, and their URLs.
// Edit these lines to pick the feeds to display.
// The format is: "FEEDBLOCKNAME" => array("url" => "http://WHATEVER.URL.YOU.WANT.COM),
// Be careful to preserve the commas at the ends of the lines (except the last entry).
//
$RY_feeds = array(
"top" => array("url" => "http://www.cnn.com"
,
"cert" => array("url" => "http://www.cert.org"
,
"bbnews" => array("url" => "http://www.espn.com"
);
// You should not have to modify any of the code below this line...
$RY_DEBUG = 0;
$RY_headlines = "";
// Find Portal Blocks
$RY_sql = "SELECT *,UNIX_TIMESTAMP(rdfupdated) as date FROM {$_TABLES['blocks']} ";
$RY_sql .= "WHERE type='portal' order by blockorder,title asc";
$RY_blocks = DB_query($RY_sql);
// Search thru Portal Blocks for the ones we are interested in.
$RY_numRows = DB_numRows($RY_blocks);
for ($RY_i=0; $RY_i<$RY_numRows; $RY_i++) {
$RY_block=DB_fetchArray($RY_blocks);
$RY_blockName=$RY_block['name'];
// Is this a feed that we are interested in displaying?
if ($RY_feeds["$RY_blockName"] > 0) {
if ($RY_DEBUG) {
$RY_headlines .= "FOUND: $RY_blockName";
$RY_headlines .= "<br>";
}
// Retrieve feed links.
COM_rdfCheck( $RY_block['bid'], $RY_block['rdfurl'], $RY_block['date'] );
$RY_links = $RY_block['content'];
if (substr($RY_links,0,5) == "Parse"
{ $RY_links="Site feed Down"; }
$RY_feeds["$RY_blockName"]["links"] = $RY_links;
$RY_feeds["$RY_blockName"]["title"] = $RY_block['title'];
}
}
// Generate output.
foreach ($RY_feeds as $RY_key => $RY_feed) {
if ($RY_DEBUG) {
$RY_headlines .= "OUTPUT: $RY_key";
$RY_headlines .= "<br>";
}
$RY_headlines .= "<a href='{$RY_feeds[$RY_key]["url"]}'>" . $RY_feeds[$RY_key]["title"] . '</a><br>';
$RY_headlines .= $RY_feeds[$RY_key]["links"];
$RY_headlines .= "<br>";
}
return $RY_headlines;
static page news feed
Posted on: 05/03/03 04:47am
By: Anonymous (Anonymous)
I have the same issue. Did figure out how to fix?
Re:static page news feed
Posted on: 08/03/03 01:35am
By: Anonymous (Matt)
[QUOTE BY= geKow]The only problem I have is that the php happens above the static page headline[/QUOTE]
Change the \'echo\' on the last line to \'return\'. The echo statement is subverting the display order.