Hi, Anyone know an easy way to format an RSS feeds for use in a Tiny Portal block ?
My problem is that I have an RSS feed I want to use but it has too many lines. There was an online tool to do this, so I could limit to say 5 entries, but I can't find it (seems to be down). Hope someone can help before I have to learn another programming language!.. thanks.
http://www.tinyportal.net/index.php?topic=11431.msg94676#msg94676
parameters could be "rssfeed" "rssfeed in a bloc" or even look in the block code and snippets board.
Another board would be tpsupport and development :)
Thanks G6 , much appreciated :) I'll try some more lookin'
Hi, is there anybody who could tell me how I can limite the lines of the rss feeds? Beneath you can see the code of my phpbox.
// An RSS Reader to grab news from whichever site you choose
$backend = "http://www.weltwoche.ch/rss/rss.xml"; //change this to match the rss feed url you wish to display.
// end
function endtheElement($parser, $tagName) {
// This function is used when an end-tag is encountered.
global $insideitem, $tag, $title, $description, $link;
if ($tagName == "ITEM") {
echo '<table width="100%" border="0"><tr>
<td class="main-table">
<span class="nav-head"><strong>
';
printf("<p><b><a href='%s'>%s</a></b></p>", // make our title into an actual link
trim($link),htmlspecialchars(trim($title))); // remove html characters from the title
echo "</tr>";
echo '<tr>
<td class="nav">';
printf("<p>%s</p>",$description); // Print out the live journal entry
echo"</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
$title = $description = $link = $insideitem = false;
}
}
// 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);
The feeds are what they are, TP only generate the code the RSS feed is called from.
So more or less you have to ask the sourse from where you call the RSS from to change it for you.
A search in here will also give you some more info on some scripts you can use to convert the RSS feeds with some generator on the net. Cant remember the url now, but a search in here or google should lead you in the right direction.
Look at the code beneath:
<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fwww.weltwoche.ch%2Frss%2Frss.xml&chan=y&num=7&desc=1&utf=y" type="text/javascript"></script>
<noscript>
<a href="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fwww.weltwoche.ch%2Frss%2Frss.xml&chan=y&num=7&desc=1&utf=y&html=y">View RSS feed</a>
</noscript>
The feedsource is exactly the same but I was able to reduce the lines. But there is something else I don't like. So I really would like to use the code I have in the phpbox but with the same possibility to limite the lines as it is possible with the code in the scriptbox.