Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 01:37 pm EST

Geeklog Forums

got a sec?


Status: offline

Mikez

Forum User
Regular Poster
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. Can someone help me
 Quote

Status: offline

yankidank

Forum User
Junior
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:
Text 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.
 Quote

Status: offline

beewee

Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
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!)


Text 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
 Quote

All times are EST. The time is now 01:37 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