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

Recent

Welcome to TinyPortal. Please login or sign up.

May 05, 2024, 07:29:20 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,178
  • Total Topics: 21,220
  • Online today: 274
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 270
  • Total: 271
  • lurkalot

RSS feed in articles not blocks???

Started by Uber_Tiny, December 20, 2006, 06:23:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Uber_Tiny

I am not an HTML wiz kid so I will ask here. Yes I have looked everywhere for others that may want this but found nothing in the search that has to do with my situation, so here goes.

I am using
SMF 1.1.1
TinyPortal v0.9.6beta

I was wondering if there is a way or if someone could help me out with the HTML on how to install an RSS feed into a article. I have tryd different ways but to no avail. Reason being is that I have it set up to where when I write a new article it places the link in the block I set up for it's category. I don't want to show the RSS feed on the main page as it takes up way to much space and they also tend to slow the site down being on the main page.

Any help would be greatly appreciated.

Oh and maybe a suggestion for feature TP setup to allow you to pick if you want an RSS feed when making an article.

G6Cad

Have you tried to convert the RSS to html script and then used the converted feed in to a script in an article ?

IF you have the RSS feed, you can go here and convert the feed to other code formats.
http://www.rss-to-javascript.com/p/138.html

Thurnok

That's a very cool site.  And a great suggestion.  Since you can use javascript in Articles, I think that will probably give you exactly what you need.  Let us know how it turns out so others might do the same.  :)

Uber_Tiny

#3
Quote from: G6 on December 20, 2006, 06:25:55 AM
Have you tried to convert the RSS to html script and then used the converted feed in to a script in an article ?

IF you have the RSS feed, you can go here and convert the feed to other code formats.
http://www.rss-to-javascript.com/p/138.html

Thanks for that link. But it didn't seem to work.  :(

This is the code I get from them.
<script language="JavaScript" src="http://convert.rss-to-javascript.com/?simple_chan=1&desc=1&src=http%3A%2F%2Fwww.nvidia.com%2Fobject%2Frss_nvidia_pressroom">
</script><noscript>Your browser does not support JavaScript. <a title='RSS-to-JavaScript.com: Free RSS to JavaScript Converter' href=http://www.rss-to-javascript.com/?p=151,381&simple_chan=1&desc=1&src=http%3A%2F%2Fwww.nvidia.com%2Fobject%2Frss_nvidia_pressroom&as_html=1>Click to read the latest news</a>.</noscript>
<a href=http://www.rss-to-javascript.com target=_blank title='RSS-to-JavaScript.com: Free RSS to JavaScript Converter'><img src=http://www.rss-to-javascript.com/images/rss-to-jss-small.gif alt='RSS to JavaScript' border=0></a>


Is there something I am missing that needs to be edited in that to make it work cause this is what it does on my site. LINK

Lesmond

heres one I use in a article (php)
Just change the feed to the one you want near the top of the code


// An RSS Reader to grab news from whichever site you choose
$backend = "http://rss.thisis.co.uk/ThisIsLeicestershire/LocalNews.rss"; //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);

Thurnok

Les has a good one.

There are a number of RSS feed blocks in the block code snippets area that look like they could work in an article, or modified to work in an article as well, even if they say they are for a center block or something.

But Les has a working one, that's probably your best bet to try out anyway.

Uber_Tiny

Awesome Lesmond!!  :up: :up:

That worked...thank you very very much!!

Crip

I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



Gidget

#8
Hi Lesmond

Thanks for the code  :)

Is it possible to add something to the php article to format the output a bit differently?

I just want to have the titles in bold and a one line gap between each story, but I can't figure out how to do it (or if it is possible to do it).

Thanks in advance and Merry Christmas

Gidget

Lesmond

Gidget I cant help you with that, not much good with PHP, but I am a expert with copy and paste :)

And a Merry Christmas to you