TinyPortal

Development => Support => Topic started by: redeye on December 03, 2005, 05:21:43 PM

Title: RSS Articles?
Post by: redeye on December 03, 2005, 05:21:43 PM
Any way of putting an RSS feed into an article?

I'm wanting to have a couple of feeds that are not on the front page but which can be linked to the content manager.

TIA
Title: Re: RSS Articles?
Post by: IchBin on December 03, 2005, 05:47:21 PM
You try creating a php article and include the rss with php?

include('yourlinktoRSShere');
Title: Re: RSS Articles?
Post by: redeye on December 03, 2005, 08:29:45 PM
Tried it and get -

Parse error: parse error, unexpected T_STRING in http://www.webbikeworld.com/motorcycles/rss.xml on line 1

using

include('http://www.webbikeworld.com/motorcycles/rss.xml');

EDIT: Just noticed that when you go back to edit the article, that the PHP tick box isn't showing.
Does that have an effect?
Title: Re: RSS Articles?
Post by: IchBin on December 04, 2005, 05:19:44 AM
Seems to be their problem not yours.
Title: Re: RSS Articles?
Post by: redeye on December 04, 2005, 09:20:02 AM
Tried a few of the rss feeds and they all give the same error - even the one that works in the RSS Block on the homepage.
Title: Re: RSS Articles?
Post by: winrules on December 04, 2005, 01:34:16 PM
Try http://jade.mcli.dist.maricopa.edu/feed/index.php?s=build that's how i put a fe feeds in my articles.
Title: Re: RSS Articles?
Post by: redeye on December 04, 2005, 03:00:51 PM
Thanks winrules.  ;)
Title: Re: RSS Articles?
Post by: JDMhustle on December 05, 2005, 08:36:41 PM
Just what i needed, thanks ;)
Title: Re: RSS Articles?
Post by: Nokonium on January 12, 2006, 10:05:58 PM
I think I've cracked it  ;D  :tickedoff: No I hadn't

This is an RSS feed from M$ - Microsoft At Home

global $context, $settings, $options, $scripturl, $txt, $modSettings;

         echo '<div style="padding: 5px;" class="smalltext">';
            TPparseRSS('http://www.microsoft.com/athome/security/rss/rssfeed.aspx');
         echo '</div>';



[Edit]Not quite, that only works if you have a block with a live feed, it must be something simple, the globals are the same for both the TPortal.template and TPortalBlocks.template.[/s]
Title: Re: RSS Articles?
Post by: elpvn on January 12, 2006, 10:40:15 PM
Quote from: winrulesTry http://jade.mcli.dist.maricopa.edu/feed/index.php?s=build that's how i put a fe feeds in my articles.

it's great, I'm success with my address RSS feed: http://www.elpvn.org/index.php?type=rss;action=.xml

Result I add this Scriptblock to TP:

<script language="JavaScript" src="http://jade.mcli.dist.maricopa.edu/feed/feed2js.php?src=http%3A%2F%2Fwww.elpvn.org%2Findex.php%3Ftype%3Drss%3Baction%3D.xml&chan=y&num=5&date=y&targ=y&html=a" type="text/javascript"></script>

<noscript>
<a href="http://jade.mcli.dist.maricopa.edu/feed/feed2js.php?src=http%3A%2F%2Fwww.elpvn.org%2Findex.php%3Ftype%3Drss%3Baction%3D.xml&chan=y&num=5&date=y&targ=y&html=y">View RSS feed</a>
</noscript>


;D Thanks

Title: Re: RSS Articles?
Post by: Nokonium on January 13, 2006, 08:00:34 AM
Attempt 2

In TPortal.php add before ?>

function RSSfeed()
{
                global $context, $settings, $options, $scripturl, $txt, $modSettings;

$backend = 'http://news.bbc.co.uk/rss/on_this_day/front_page/rss091.xml';
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
// end


// Now to the parsing itself. Starts by creating it:

$xml_parser = xml_parser_create();

// Then setup the handlers:

xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");

// Open the actual datafile:

$fp = fopen($backend, "r");

// Run through it line by line and parse:

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)));
}

// Close the datafile

fclose($fp);

// Free any memmory used

xml_parser_free($xml_parser);

}


PHP article

global $context, $settings, $options, $scripturl, $txt, $modSettings;

         echo '<div style="padding: 5px;" class="smalltext">';
        RSSfeed();
         echo '</div>';


What are the pros and cons of having a seperate function for each RSS feed?
Title: Re: RSS Articles?
Post by: Nokonium on January 15, 2006, 06:48:09 PM
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.nokonium.plus.com%2Fblack-cat%2Funsorted%2Fattention.gif&hash=6926f406611542acf1da2721d0d651ef6b7bca65)

I now have 4 feeds working using different function namesÃ,  ;D

Now a further question, some of the feeds appear to want to show an image. From the positioning of it it could be a bullet point.

How can I either enable it to pick up an image and display it or stop it displaying the rectangle with image in it.

This Computer Weekly feed displays what I mean.

http://www.computerweekly.com/Feeds/RSS.aspx?cat=108
Title: Re: RSS Articles?
Post by: RoarinRow on July 21, 2006, 06:56:01 PM
Very cool, this worked, thanks!  :up: