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: 500
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 384
  • Total: 384

Try to implement lastRSS

Started by boldt, May 01, 2007, 01:57:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

boldt

I want to establish a rss-news block on my TinyPortal and for that purpose I have made some "cut&paste" around lastRSS. http://lastrss.oslab.net/
This is what I have been doing so far:

Added following to lastRSS.php:
function ShowOneRSS($url)
{
    global $rss;
    if ($rs = $rss->Get($url))
{
        echo '<h2><a href="'.$rs['link'].'">'.$rs['title']."</a></h2>\n";
        echo "<p>\n";
    foreach($rs['items'] as $item)
{echo "\t<a href=\"$item[link]\">".$item['title']."</a><br />".$item['description']."<br /><br />\n";
         }
      }
      if ($rs['items_count'] <= 0) { echo "Kunne ikke l&aelig;se RSS fra siden  :-("; }
      echo "</p>\n";
}

Placed the lastRSS.php in the root of smf.

Added following in the top of the of smf index.phpinclude "./lastRSS.php";

created a new block in TinyPortal - a phpbox where I have typed following code$rss = new lastRSS;
$rss->cache_dir = './temp';
$rss->cache_time = 1200; // (5 seconds)
$rss->cp = 'UTF-8';
$rss->items_limit = 5;

echo '<table cellpadding="10" border="0"><tr><td width="50%" valign="top">';
ShowOneRSS('http://www.dr.dk/Nyheder/Service/feeds/Penge.htm');
echo '</td><td width="50%" valign="top">';
ShowOneRSS('http://www.computerworld.dk/rss/all');
echo '</td></tr></table>';
(Yes I'm Danish)

All the codes works when I put then together on a clean web-page, but when I do it here in TinyPortal I get following error-message:
QuoteFatal error: Call to a member function Get() on a non-object in C:\xampp\htdocs\smf\lastRSS.php on line 223
(and yes, I am working with Apachefriend on my own pc)

Can anybody tell me what is wrong?

kind regards

Mikael Boldt

boldt

Sorry I had made a small mistake when inserting the function ShowOneRSS, but I stll get an error.
However this time the error says:
QuoteFatal error: Call to undefined function ShowOneRSS() in C:\xampp\htdocs\smf\Sources\Load.php(1735) : eval()'d code(35) : eval()'d code on line 8

And now I'm completely lost

kind regards

Mikael Boldt

JPDeni

Try putting the full path in your "include" statement. I think that's likely the problem. If putting the full path doesn't do it, try some other permutations.

I would put the "include" statement into the phpblock, since that's the only time you're using it. I like to keep everything together. What you're doing isn't wrong. It's just different than I'd do it. :)

boldt

I didn't succeed

Perhaps a different approach?

I have 4 RSS and i have a programme that can create a table with the content.
I want to have the table in the bottom of the tinyportal page - under the panels but above the "powered by" line.

How do I do it, without using the block-system?

kind regard

Mikael Boldt

JPDeni

You would need to put it into the index.template.php file for your theme.

This website is proudly hosted on Crocweb Cloud Website Hosting.