Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: 1 [2] 3

Author Topic: [ADDON] Grab external feeds  (Read 21815 times)

mosh

  • Dev Invitee
  • Hero Member
  • *****
  • Karma: 77
  • Posts: 521
  • Awesome day :)
[ADDON] Grab external feeds
« Reply #15 on: September 26, 2006, 10:28:43 PM »

yes, no problem :)

http://www.solucija.com/rss/   <---- // you will not get feeds

http://www.solucija.com/rss.xml     <---- // that will work


hope that help :)
Logged

philmoz

  • High flyer
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 2001
    • fiddle 'n fly
[ADDON] Grab external feeds
« Reply #16 on: September 26, 2006, 11:38:45 PM »

Quote from: mo
yes, no problem :)

http://www.solucija.com/rss/   <---- // you will not get feeds

http://www.solucija.com/rss.xml     <---- // that will work


hope that help :)
Nope, didn't work....  

Now I am wondering whether my simplepie isn't set up right.
(I can read feeds that have a physical file, so I is working.)

Need some ideas to track down problem.
Logged
Of all the things I have lost, it is my mind that I miss the most.

elkie

  • Newbie
  • *
  • Karma: 0
  • Posts: 4
[ADDON] Grab external feeds
« Reply #17 on: September 27, 2006, 04:13:57 AM »

I think it is an issue with dates.  When I use the feed http://www.solucija.com/rss.xml     all the dates equal Dec.31, 1969.  Simplepie is not parsing the feed correctly either due to error in simplepie or the RSS feed itself.  I think it is the feed as other RSS sites done with sNews don't seem to have the same issue.

Brian
Logged

Fred K

  • sNews Dude
  • ULTIMATE member
  • *****
  • Karma: 131
  • Posts: 2798
[ADDON] Grab external feeds
« Reply #18 on: September 27, 2006, 08:45:22 AM »

It says in simplepie's docs that it won't parse feeds with no dates (or incorrect dates). I also think --but I could be wrong of course-- that solucija still uses the original 1.4 RSS feed incorporation method, which didn't work properly. I can't get it into simplepies feed system either, and Safari's feed reader still won't parse it either, so...

philmoz

  • High flyer
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 2001
    • fiddle 'n fly
[ADDON] Grab external feeds
« Reply #19 on: November 07, 2006, 09:12:49 AM »

Code: [Select]
http://www.solucija.com/rss//rss.xmlthe above works.
Logged
Of all the things I have lost, it is my mind that I miss the most.

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4957
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: [ADDON] Grab external feeds
« Reply #20 on: May 13, 2008, 03:26:30 PM »

I got a simplepie up and running, but I have no possibility to style it, edit it, or whatever, hehe... But the news is there,
Logged
My sNews site
"It's only dead fish that goes with the flow... "
Updated, online again - Free designs

Sven

  • Dev Invitee
  • ULTIMATE member
  • *****
  • Karma: 88
  • Posts: 2069
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: [ADDON] Grab external feeds
« Reply #21 on: February 19, 2009, 09:49:53 AM »

Almost a year later... ;D
Can someone give a hand to the famous php idiot of the forum?
I just installed this piece of cake called Simple Pie,
and the demo in the package is working fine.

But but but... how can I make it work in an sNews page of mine?
I just put this piece of code:
Quote
   <div class="header">
      <h1><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h1>
      <p><?php echo $feed->get_description(); ?></p>
   </div>
 
   <?php
   /*
   Here, we'll loop through all of the items in the feed, and $item represents the current item in the loop.
   */
   foreach ($feed->get_items() as $item):
   ?>
 
      <div class="item">
         <h2><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
         <p><?php echo $item->get_description(); ?></p>
         <p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
      </div>
 
   <?php endforeach; ?>
and html output code result is:
Quote
      <h1><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h1>
      <p><?php echo $feed->get_description(); ?></p>
   </div>
 
   <?php
   /*
   Here, we'll loop through all of the items in the feed, and $item represents the current item in the loop.
   */
   foreach ($feed->get_items() as $item):
   ?>
 
      <div class="item">
         <h2><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
         <p><?php echo $item->get_description(); ?></p>

         <p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
      </div>
 
   <?php endforeach; ?
As always need your 3 minutes (?) help to make it work.  :-[

bikoz

  • Jr. Member
  • **
  • Karma: 3
  • Posts: 66
Re: [ADDON] Grab external feeds
« Reply #22 on: February 19, 2009, 11:57:32 AM »

Just my guess:

Try to put the whole code (HTML and PHP) in an external text file, say "script.php", and insert the file with [include]path/to/script.php[/include] on the actual sNews page.

And of course, tell us if this works. :-)
Logged

Sven

  • Dev Invitee
  • ULTIMATE member
  • *****
  • Karma: 88
  • Posts: 2069
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: [ADDON] Grab external feeds
« Reply #23 on: February 19, 2009, 02:59:27 PM »

Hello Mr Vincent,
et merci pour ton message et ta réponse.

I made what you said and nope, still not workin out.
But now it says:
Quote
Fatal error: Call to a member function get_permalink() on a non-object in D:\xampp\htdocs\richard\script.php on line 2

I've followed those instructions: http://simplepie.org/wiki/setup/setup
and for the php code followed this instructions in this page: http://simplepie.org/wiki/setup/sample_page

I thought those recipes were enough to make my pie, but you know I'm a dumb PHP cook. ;D


lann

  • Newbie
  • *
  • Karma: 1
  • Posts: 17
Re: [ADDON] Grab external feeds
« Reply #24 on: February 19, 2009, 04:03:34 PM »

for example in your Snews index.php (or index of your theme ) u have to add <?php require 'php/simplepie.inc'; ?>  that works on my site
Logged

lann

  • Newbie
  • *
  • Karma: 1
  • Posts: 17
Re: [ADDON] Grab external feeds
« Reply #25 on: February 19, 2009, 04:19:06 PM »

Step 1 add <?php require 'php/simplepie.inc'; ?> in index.php

Step 2 your code ...
Quote
<div class="header">
      <h1><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h1>
      <p><?php echo $feed->get_description(); ?></p>
   </div>
   ...

Step 3
 then you can put it (php code) in an external text/ php file and insert the file with [include] on your page
Logged

bikoz

  • Jr. Member
  • **
  • Karma: 3
  • Posts: 66
Re: [ADDON] Grab external feeds
« Reply #26 on: February 19, 2009, 04:47:25 PM »

I made what you said and nope, still not workin out.
But now it says:
Quote
Fatal error: Call to a member function get_permalink() on a non-object in D:\xampp\htdocs\richard\script.php on line 2

I guess the [include]...[/include] does not take care of libraries/classes dependencies.

You should add the necessary "include" statements at the top of index.php as Iann mentioned.

Let us know.
Logged

Sven

  • Dev Invitee
  • ULTIMATE member
  • *****
  • Karma: 88
  • Posts: 2069
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: [ADDON] Grab external feeds
« Reply #27 on: February 19, 2009, 05:40:44 PM »

Well, it's already in the file:
Quote
<?php
// Make sure SimplePie is included. You may need to change this to match the location of simplepie.inc.
require_once('php/simplepie.inc');
 
// We'll process this feed with all of the default options.
$feed = new SimplePie('http://simplepie.org/blog/feed/');
 
// This makes sure that the content is sent to the browser as text/html and the UTF-8 character set (since we didn't change it).
$feed->handle_content_type();
?>
- simplepie.inc, is in the PHP folder,
- cache directory is present too,
- and engine (create.php) at the root.

 ???

bikoz

  • Jr. Member
  • **
  • Karma: 3
  • Posts: 66
Re: [ADDON] Grab external feeds
« Reply #28 on: February 19, 2009, 05:53:36 PM »

Just to be sure:

- The require_once('php/simplepie.inc'); statement goes at the top of your (sNews) index.php file.

- Both $feed = new SimplePie('http://simplepie.org/blog/feed/'); and $feed->handle_content_type(); are in the custom script (text file) that you include from [include]script.php[/include] in your snews page.

This is how I see it... but I may be totally wrong.


Logged

lann

  • Newbie
  • *
  • Karma: 1
  • Posts: 17
Re: [ADDON] Grab external feeds
« Reply #29 on: February 19, 2009, 05:58:22 PM »

Did you try :

AT THE BEGINNING AND WITHOUT SPACE before <?
********************************************************************************your index page *********************
<?php require 'php/simplepie.inc'; ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> ........ bla bla
Logged
Pages: 1 [2] 3