Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 02:24 pm EDT

Geeklog Forums

static page news feed


Status: offline

scroff

Forum User
Regular Poster
Registered: 02/19/03
Posts: 111
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.
 Quote

Status: offline

squatty

Forum User
Full Member
Registered: 01/21/02
Posts: 269
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. The download is here.

---
Danny @ squatty.com


In a world without walls and fences, who needs Windows and Gates?
 Quote

Status: offline

geKow

Forum User
Full Member
Registered: 01/12/03
Posts: 445
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
 Quote

Status: offline

scroff

Forum User
Regular Poster
Registered: 02/19/03
Posts: 111
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
 Quote

Status: offline

rei

Forum User
Newbie
Registered: 09/28/02
Posts: 2
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"Wink, "cert" => array("url" => "http://www.cert.org"Wink, "bbnews" => array("url" => "http://www.espn.com"Wink ); // 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"Wink { $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;
 Quote

Anonymous

Anonymous
I have the same issue. Did figure out how to fix?
 Quote

Matt

Anonymous
Quote by geKow:The only problem I have is that the php happens above the static page headline
Change the \'echo\' on the last line to \'return\'. The echo statement is subverting the display order.
 Quote

All times are EDT. The time is now 02:24 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content