TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 141
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 100
  • Total: 100

RSS Articles?

Started by redeye, December 03, 2005, 05:21:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nokonium

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?

Nokonium

#11


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

RoarinRow

Very cool, this worked, thanks!  :up:

SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0

This website is proudly hosted on Crocweb Cloud Website Hosting.