Topics

User Functions

Events

There are no upcoming events

What's New

Stories

No new stories

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Friday, May 24 2013 @ 04:10 AM EDT


 Forum Index > Extensions > Cool Hacks New Topic Post Reply
 got a sec?
   
Mikez
 08/27/05 02:51AM (Read 1768 times)  
++++-
Regular Poster

Status: offline


Registered: 06/17/05
Posts: 87
I want to add even more news to my sight.
More thin is reasonable on the front page.

And I don't know nothing about RSS.
So can someone help me out and tell me how to do this.

What I was going to do is make it were only one news article was on the front page.
AKA the Featured Article.

And thin use static pages to go under that.

And in them, use the new RSS set up to show the title and date of the new articles or each given topic.
That way they can click and read what they want.

Like if it was dune here.
There well be 6 static page boxes.

Geeklog
Geeklog 2
Announcements
Security
Server
Spam

It needs to have something that I can adjust the limit.
Say like the last 10 stories.
And only news with in the last 48 hours.
It can be in just the code.
As long as it's there.

I know how to do everything but the code that needs to be in the Static page.

please can someone tell me the code to do this.

 
Profile Email
 Quote
yankidank
 10/05/05 04:03PM  
++---
Junior

Status: offline


Registered: 04/03/05
Posts: 17
This is deffinitely not the best way to do it, but if you are willing to use a combination of Javascript, RSS, and static blocks and have longer load times you could do what I did on this page. The load time for that page is usually about 7 seconds, which is a lot when you think about it. It uses javascript to fetch and render 18 RSS feeds in a static page. Since it doesn't cache the data locally, fetching the RSS feed takes a while to do with that many feeds. If you only want to have 4 RSS feeds it would go much faster. The other thing that slows the load time is that it's fetching 174 stories in total. All but one of those 18 RSS feeds display 10 articles with links. This method will only show titles with links, not the full story.

Here's how you can do it:
Go to feedonsite.com's RSS publisher page. Enter an RSS feed then go to the next page. Customize the feed to display however many articles you want and how many characters you want to display for the article title.

Here's a condensed version of my static page code with 6 tables:
PHP Formatted Code
  <table align="center" border="0" width="102%">
<tr valign="top" align="center">
  <td width="30%"><div id="table_full">
      <div id="table_head">
        <div id="table_head"><a href="http://www.yankidank.com" >Yankidank</a></div>
        <div id="table_time"> Video Game News </div>
        <div align="left">
          <div id="table_links">
            <script src="http://www.feedonsite.com/showfeed.php?f=P4h2bmv2f5Q6X7t2"></script>
          </div>
        </div>
      </div>
  </div></td>
  <td width="30%"><div id="table_full">
      <div id="table_head">
        <div id="table_head"><a href="http://news.yahoo.com/i/869" >Yahoo Games </a></div>
        <div id="table_time"> Game and Tech News </div>
        <div align="left">
          <div id="table_links">
            <script src="http://www.feedonsite.com/showfeed.php?f=c3BpWrS4q0Jty7T1"></script>
          </div>
        </div>
      </div>
  </div></td>
  <td width="30%"><div id="table_full">
      <div id="table_head">
        <div id="table_head"><a href="http://www.amazon.com/exec/obidos/redirect?tag=gp04-20&path=tg/browse/-/468642" >Amazon</a></div>
        <div id="table_time"> Top Video Game Sales </div>
        <div align="left">
          <div id="table_links">
            <script src="http://www.feedonsite.com/showfeed.php?f=n8D3cjD8o0s4b5br"></div></script>
          </div>
        </div>
      </div>
  </div></td>
</tr>
<tr valign="top" align="center">
  <td><div id="table_full">
      <div id="table_head">
        <div id="table_head"><a href="http://gametrailers.com/" >GameTrailers</a></div>
        <div id="table_time"> Game Video Trailers</div>
        <div align="left">
          <div id="table_links">
            <script src="http://www.feedonsite.com/showfeed.php?f=i5r0Y2G2B4c0o0ef"></script>
          </div>
        </div>
      </div>
  </div></td>
  <td><div id="table_full">
      <div id="table_head">
        <div id="table_head"><a href="http://www.pressthebuttons.com/" >Press The Buttons </a></div>
        <div id="table_time"> Game Blog </div>
        <div align="left">
          <div id="table_links">
            <script src="http://www.feedonsite.com/showfeed.php?f=G0u3z0EpE6p5UmSd"></script>
          </div>
        </div>
      </div>
  </div></td>
  <td><div id="table_full">
      <div id="table_head">
        <div id="table_head"><a href="http://www.digg.com" >Digg</a></div>
        <div id="table_time"> Tech News </div>
        <div align="left">
          <div id="table_links">
            <script src="http://www.feedonsite.com/showfeed.php?f=a4N3V8Z2s8Z8O8k7"></script>
          </div>
        </div>
      </div>
  </div></td>
</tr>
</table>

 


Then tell the static page to be a centerblock and fill in where you want it.
This code probably isn't what your's looking for, but I thought that it was a good method, besides the load time for so many feeds.

 
Profile Email Website
 Quote
beewee
 10/06/05 02:02AM  
+++++
Full Member

Status: offline


Registered: 08/05/03
Posts: 969
Perhaps this is what you're looking for, haven't tried it yet: http://www.globalsyndication.com/rss-parser

Or this, it converts a feed to javascript, and works on your own webserver, you can put multiple javascripts in a table:
http://benruth.com/?page_id=68 (and I have tried it, it works fine)

Last option, put this PHP code in a static page and enable PHP for static pages (read the FAQs about this!)


PHP Formatted Code

$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
$locations = array('YOUR-FEED-URL');
srand((float) microtime() * 10000000); // seed the random gen
$random_key = array_rand($locations);
function startElement($parser, $name, $attrs) {
 global $insideitem, $tag, $title, $description, $link;
 if ($insideitem) {
  $tag = $name;
 } elseif ($name == "ITEM") {
  $insideitem = true;
 }
}
function endElement($parser, $name) {
 global $insideitem, $tag, $title, $description, $link;
 if ($name == "ITEM") {
  printf("<div><a href='%s'>%s</a><br>",
  trim($link),htmlspecialchars(trim($title)));
  printf("%s</div>",htmlspecialchars(trim($description)));
  $title = "";
  $description = "";
  $link = "";
  $insideitem = false;
 }
}
function characterData($parser, $data) {
 global $insideitem, $tag, $title, $description, $link;
 if ($insideitem) {
 switch ($tag) {
  case "TITLE":
  $title .= $data;
  break;
  case "DESCRIPTION":
  $description .= $data;
  break;
  case "LINK":
  $link .= $data;
  break;
 }
 }
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen($locations[$random_key], 'r')
 or die("Error reading RSS data.");
while ($data = fread($fp, 4096))
 xml_parse($xml_parser, $data, feof($fp))
  or die(sprintf("XML error: %s at line %d",
   xml_error_string(xml_get_error_code($xml_parser)),    
   xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);

 


Use a feed with headlines/titles only

Dutch Geeklog sites about camping/hiking: www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 
Profile Email Website
 Quote
Content generated in: 0.61 seconds
New Topic Post Reply

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