TinyPortal

Development => Block Codes => Topic started by: URPG on August 07, 2006, 06:59:23 PM

Title: Advanced RSS Feed
Post by: URPG on August 07, 2006, 06:59:23 PM
Hi there. I have been writing in an old thread about it, but apperantly nobody seems to read it...

The RSS Block is just very basic, I have done this one (from scratch and spare code found on the net, since nobody provided me with the code TP uses to do an rss box) and so far it does:


//RSS Newsreader

  $backend = "http://rss.cnn.com/rss/cnn_world.rss";
  $max_items = 10;
  $items = 0;
  $ausgabe_temp = "<b>CNN-World Newsfeed:</b><br><marquee direction=up scrolldelay=3 scrollamount=1 height=16 onmouseout=this.start() onmouseover=this.stop()>";

  $fpread = fopen($backend, 'r');
  if(!$fpread) {
      echo "error $errstr ($errno)<br>\n";
      exit;
  } else {

       while(! feof($fpread) ) {

          $buffer = ltrim(Chop(fgets($fpread, 256)));

          if (($buffer == "<item>") && ($items < $max_items)) {
            $title = ltrim(Chop(fgets($fpread, 256)));
            $link = ltrim(Chop(fgets($fpread, 256)));
            $description = ltrim(Chop(fgets($fpread, 256)));

            $title = ereg_replace( "<title>", "", $title );
            $title = ereg_replace( "</title>", "", $title );
            $link = ereg_replace( "<link>", "", $link );
            $link = ereg_replace( "</link>", "", $link );
            $description = ereg_replace( "<description>", "", $description );
            $description = ereg_replace( "</description>", "", $description );     

            $ausgabe_temp .= "<a href=\"".$link."\"><b><big>".$title."</big></b></a><br><small>".$description."</small><br>";
            $items++;
          }
      }
      fclose($fpread);
  }

// alle daten sind in $ausgabe_temp
echo $ausgabe_temp;
echo '</marquee>';


I'd like to make it variable so you can set the scroll to 1 or 0 and variable speed, etc. maybe even include multiple RSS feeds, but before that a minor annoyance has to be solved:

It does only display a single line that it is scrolling smoothly. Does anyone know how i can enlarge the area?

Demo on bottom of my Frontpage: http://www.urpg.info
Title: Re: Advanced RSS Feed
Post by: Crip on August 07, 2006, 07:05:46 PM
URPG.
Where did you get and do the Langage Translate deal?

crip
Title: Re: Advanced RSS Feed
Post by: URPG on August 07, 2006, 08:04:55 PM
Thant language translation is something i tried to get help on here and in SMF forum, no replies at all...

It's basically calling up altavista translation site with your URL in it. Still got some bug like translating an already translated site does produce an empty page and i do not know how to get rid of the iframe. If you want to look into it / help with it, go here in Bloczone Forum: URL translation for TP (http://www.tinyportal.net/smf/index.php?topic=5384.0)

What about the scrolling RSS box? any ideas? i did add some BR's but it does not seem to help any...
Title: Re: Advanced RSS Feed
Post by: k_4_kelly on August 07, 2006, 10:32:54 PM
hello,

may i know for the Advanced RSS Feed, which type/code of block are u using?  php or script?  i tried php, script and html...it didnt work for me.....did i missed something??
Title: Re: Advanced RSS Feed
Post by: URPG on August 07, 2006, 11:14:15 PM
It's a "phpBox", just copy + paste the code above, it's exactly what's running at my side. Just to make sure i will copy + paste it again into the above topic!

Any idea about the size issue?

EDIT: Done, i opened the Block on my site and copy+paste the code again... *must* work now!
Title: Re: Advanced RSS Feed
Post by: Nokonium on August 08, 2006, 06:37:38 AM
Nice work, though there is a small problem. In the Opera browser the mouseover doesn't stop the scrolling.
Title: Re: Advanced RSS Feed
Post by: IchBin on August 08, 2006, 06:41:55 AM
Sounds like a personal problem to me. :P
Title: Re: Advanced RSS Feed
Post by: Nokonium on August 08, 2006, 06:51:44 AM
Opera and I are just good friends

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.nokonium.plus.com%2Fblack-cat%2Fbubbles%2Featmyshorts.gif&hash=1b8c3a71edb9d54c437f868d922b3b6e46238259)

Firefox fiend
Title: Re: Advanced RSS Feed
Post by: URPG on August 08, 2006, 11:05:45 AM
Actualy Marquee is an IE element that also became supported by Netscape / Mozilla don't know why Opera does not do it. Do you have any other sugestion to make it scroll? I will gladly put it in. But as i heard Javascript is not fully supported by Opera either  :coolsmiley:

Anything on the height problem? I'd like it to be more then one line  :tickedoff:
Title: Re: Advanced RSS Feed
Post by: Crip on August 08, 2006, 11:58:31 AM
Do you have the <Iframe Height="100%"... ?
Title: Re: Advanced RSS Feed
Post by: URPG on August 08, 2006, 12:12:54 PM
I don't have any iFrame tag included... I don't need an iframe, i read the rss and echo it out.  :o

EDIT:
I tried to put it in an iframe, but i just got an empty frame. (had no file to put as src anyway)... other ways to set a fixed height of the box?
Title: Re: Advanced RSS Feed
Post by: Crip on August 08, 2006, 12:14:41 PM
You could try that yes.
Title: Re: Advanced RSS Feed
Post by: Crip on August 08, 2006, 12:16:28 PM
Maybe you can try it in a leftside or rightside block..might work?
Title: Re: Advanced RSS Feed
Post by: URPG on August 08, 2006, 12:20:10 PM
Same in a left side block.

It seems that it does get loaded normaly and once the marquee starts it does get resized to one line...

I did reset the marquee height=90% it was set to 16 pixel not 16 rows  ::) but now it stoped scrolling at all...  :uglystupid2:
Title: Re: Advanced RSS Feed
Post by: Crip on August 08, 2006, 12:22:46 PM
can you put rss feed in an iframe?...I'm not sure?
Title: Re: Advanced RSS Feed
Post by: Crip on August 08, 2006, 12:27:01 PM
try a <div tag before and after </div>
Title: Re: Advanced RSS Feed
Post by: URPG on August 08, 2006, 12:28:14 PM
I did simply set the marquee size too small! I can resize it to any pixel height and it does scroll! (it's working right now @100px take a look http://www.urpg.info )

But as soon as i set it to a percentage it does stop scrolling :(
Title: Re: Advanced RSS Feed
Post by: Crip on August 08, 2006, 12:31:43 PM
Thats higher than it was..just increase the height a bit at a time
Title: Re: Advanced RSS Feed
Post by: URPG on August 08, 2006, 12:36:32 PM
O.K. here is my new version of the advanced RSS thingy:

//RSS Newsreader

  $backend = "http://rss.cnn.com/rss/cnn_world.rss";
  $headline = "CNN World News";
  $max_items = 16;
  $items = 0;
  $height = 200;
  $scroll = 1; //1 for scrolling box 0 for no scrolling
  $amount = 1; //pixels per scroll step
  $delay = 25; //step delay ms
  $stop = 1; //1 for scroll stop on mouseover 0 for no stop

  if($scroll==0)$stop=0; //no scrollstop if no scrolling

  $output_temp = "<b> $headline </b><br>";

//add marquee tag if scrolling is enabled
  if($scroll) output_temp .="<marquee direction=up scrolldelay=$delay scrollamount=$amount height=$height ";

//only add mouse events if wanted
  if($stop) $output_temp .="onmouseout=this.start() onmouseover=this.stop()>"; else $output_temp .=">";

  $fpread = fopen($backend, 'r');
  if(!$fpread) {
      echo "error $errstr ($errno)<br>\n";
      exit;
  } else {

       while(! feof($fpread) ) {

          $buffer = ltrim(Chop(fgets($fpread, 256)));

          if (($buffer == "<item>") && ($items < $max_items)) {
            $title = ltrim(Chop(fgets($fpread, 256)));
            $link = ltrim(Chop(fgets($fpread, 256)));
            $description = ltrim(Chop(fgets($fpread, 256)));

            $title = ereg_replace( "<title>", "", $title );
            $title = ereg_replace( "</title>", "", $title );
            $link = ereg_replace( "<link>", "", $link );
            $link = ereg_replace( "</link>", "", $link );
            $description = ereg_replace( "<description>", "", $description );
            $description = ereg_replace( "</description>", "", $description );     

            $output_temp .= "<a href=\"".$link."\"><b><big>".$title."</big></b></a><br><small>".$description."</small><br>";
            $items++;
          }
      }
      fclose($fpread);
  }

// alle daten sind in $ausgabe_temp
echo $output_temp;
echo '</marquee>';


You can set:
  $backend for your RSS feed
  $headline non scrolling headline
  $max_items for maximum items grabbed
  $height the height of the element in pixel
  $scroll set to 1 for scrolling box with marquee set to 0 for no scrolling
   $amount pixel scroleld per step
   $delay ms delay per step
   $stop set to 1 for stop on mouseover set to 0 for no stop

Things to be solved:
Title: Re: Advanced RSS Feed
Post by: daygo140 on August 13, 2006, 03:58:59 AM
Can u gimme a find/replace to make it when u click a link from the feed that it opens in a new window/tab (_blank)?
Title: Re: Advanced RSS Feed
Post by: G6Cad on August 13, 2006, 09:01:53 AM
Try to convert the rss feed to a script instead.
Go to this page and follow the steps and see if you get a better layout on the feed
http://www.rss-to-javascript.com/p/138.html
Then put the feed in a java/html block
Title: Re: Advanced RSS Feed
Post by: daygo140 on August 13, 2006, 12:56:48 PM
Quote from: G6 on August 13, 2006, 09:01:53 AM
Try to convert the rss feed to a script instead.
Go to this page and follow the steps and see if you get a better layout on the feed
http://www.rss-to-javascript.com/p/138.html
Then put the feed in a java/html block

Will that keep the neat scrolling function or will I lose that?

There is no possible way to add target="_blank" into that php script?  Where's the PHP gurus....?
Title: Re: Advanced RSS Feed
Post by: G6Cad on August 13, 2006, 01:16:32 PM
They will come around when yhey have the time for the every day life they have ;)

Im not sure if the scroll will come up, you have to try your way through :)
Title: Re: Advanced RSS Feed
Post by: daygo140 on August 13, 2006, 02:17:39 PM
Quote from: G6 on August 13, 2006, 01:16:32 PM
They will come around when yhey have the time for the every day life they have ;)

Im not sure if the scroll will come up, you have to try your way through :)

I'd rather wait it out and add target="_blank" into that php script.  I really like it.  I did try adding it a few different ways but I was unsuccessful...I can patiently wait for the honorable php'ers!!!
Title: Re: Advanced RSS Feed
Post by: URPG on August 13, 2006, 04:53:01 PM
I don't think putting it into a script will sovle any problems... Opera does not work fully with JavaScript either, so it won't improve the scrolling problem Opera has...

I added some blank lines in front and after the news and it's looking real neath now on my page.

What we need now is real TP integration like the RSS box has, so any user could install and configure it...

Target=_blank to open the news in a new browser window? The link comes out of the rss feed, don't know if we could simply change it :-/
Title: Re: Advanced RSS Feed
Post by: daygo140 on August 13, 2006, 07:43:29 PM
Quote from: URPG on August 13, 2006, 04:53:01 PM
Target=_blank to open the news in a new browser window? The link comes out of the rss feed, don't know if we could simply change it :-/

I noticed this piece from your code:

$ausgabe_temp .= "<a href=\"".$link."\"><b><big>".$title."</big></b></a>....

That is ultimately the link, is it not?  If so can't you somehow add target="_blank" into there.  I am a big php n00b so don't laugh...

can't u do this....

$blank = ereg_replace( "target=_blank", "", $blank );

Then add it into the above somehow.  Or is that an unnecessary step and you can somehow add simply target=_blank into it?

I experimented with it a little but I didn't have something right because it yielded errors.  I bet a php guru can do it with little effort.
Title: Re: Advanced RSS Feed
Post by: URPG on August 13, 2006, 11:11:56 PM
This is the most up to date code (where you can set all parameters in the header).

I added a target=_blank inside the link statement. It's html, it's only put together by php commands. If your attempt did not work, make sure not to include those "   " since they will disrupt the php code, you don't need them in html anyway.

//RSS Newsreader

  $backend = "http://rss.cnn.com/rss/cnn_world.rss";
  $max_items = 16;
  $items = 0;
  $scroll = 1; //1 for scrolling box 0 for no scrolling
  $amount = 1; //pixels per scroll step
  $delay = 25; //step delay ms
  $stop = 1; //1 for scroll stop on mouseover 0 for no stop

  if($scroll==0)$stop=0; //no scrollstop if no scrolling

  $output_temp = "<b>CNN-World Newsfeed:</b><br>";

//add marquee tag if scrolling is enabled
  if($scroll) $output_temp .="<marquee direction=up scrolldelay=$delay scrollamount=$amount height=200 ";

//only add mouse events if wanted
  if($stop) $output_temp .="onmouseout=this.start() onmouseover=this.stop()><br><br><br><br><br><br><br>"; else $output_temp .="><br><br><br><br><br><br><br><br>";

  $fpread = fopen($backend, 'r');
  if(!$fpread) {
      echo "error $errstr ($errno)<br>\n";
      exit;
  } else {

       while(! feof($fpread) ) {

          $buffer = ltrim(Chop(fgets($fpread, 256)));

          if (($buffer == "<item>") && ($items < $max_items)) {
            $title = ltrim(Chop(fgets($fpread, 256)));
            $link = ltrim(Chop(fgets($fpread, 256)));
            $description = ltrim(Chop(fgets($fpread, 256)));

            $title = ereg_replace( "<title>", "", $title );
            $title = ereg_replace( "</title>", "", $title );
            $link = ereg_replace( "<link>", "", $link );
            $link = ereg_replace( "</link>", "", $link );
            $description = ereg_replace( "<description>", "", $description );
            $description = ereg_replace( "</description>", "", $description );     

            $output_temp .= "<a href=\"".$link."\" target=_blank><b><big>".$title."</big></b></a><br><small>".$description."</small><br>";
            $items++;
          }
      }
      fclose($fpread);
  }

// alle daten sind in $ausgabe_temp
echo $output_temp;
echo '<br><br><br><br><br><br><br><br><br><br></marquee>';


Not all of this is my code, i took a very basic "rss to your website" thingy from some tutorial and heavilie modified it...




Any of you official TP guys around? How do we integrate this as RSS block replacement?
Title: Re: Advanced RSS Feed
Post by: daygo140 on August 14, 2006, 01:18:00 AM
PERFECT....!!!

Title: Re: Advanced RSS Feed
Post by: URPG on August 14, 2006, 01:41:51 AM
If you want more or less empty lines just multiply the BR tags... haven't found a good way to scale it's size and add according free lines automatically.
Title: Re: Advanced RSS Feed
Post by: daygo140 on August 14, 2006, 01:50:14 AM
http://www.teamgpk.com/

Check it out!  Of course I added a lil' flavah to it, more when I get a chance to mess with it since now I know "" throws off php. 

Only thing that bugs me is that the scroll isn't as desirable in IE.  I'm not talking speed here but once the feeds cycle through you get the same amount of blank space and you need to wait for the feeds to recycle.  In FireFox no issues whatsoever...suggestions anyone?
Title: Re: Advanced RSS Feed
Post by: daygo140 on August 14, 2006, 02:02:46 AM
I got it all those darn n00b (lol) breaks did it.  I used the original code (in addition to the _blank WITHOUT QUOTES...LOL) in your very first post and at height i turned to 175px.  No unnecessary breaks and it works fine in IE now....!
Title: Re: Advanced RSS Feed
Post by: URPG on August 14, 2006, 09:44:44 AM
Well, the last i posted is easier to configure, if you would want to change speed, etc. you would not have to dig it up inside the code...
Title: Re: Advanced RSS Feed
Post by: daftdate on August 25, 2006, 11:06:49 PM
ive tried to use your code to get a scrolling rss feed block but when i enter my rss feed url its not giving me the correct link.

http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/england/west_midlands/rss.xml

is it because its an xml file? rather than the type of file that you have for CNN.  It lists and scrolls the headlines but when i click on one it puts my forums address up and cant find the address to the feed weird really as the CNN works perfectly but i want my students to see local news.  :)

the feed pulls into the rss block with tiny portal perfectly i just wanted it to scroll and open in a separate window to stop students navigating away from the forum.
Title: Re: Advanced RSS Feed
Post by: URPG on August 26, 2006, 01:40:09 AM
That's strange... actualy rss files are supposed to be xml files with special contend... as far as i understood it. The script should read the parts and put it together...

Could be another standard? Did you compare the xml file and the rss file? Do they look the same?
Title: Re: Advanced RSS Feed
Post by: daftdate on August 26, 2006, 09:00:06 AM
this is the scroll feed I get when i put in my local xml feed as you can see it puts the http address up under the headline but doesnt link to the feed when you click on it.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fimages5.theimagehosting.com%2Frssfeed1.th.jpg&hash=41dcbe9ce94d963eef3588f97a2b1025837d95fe) (http://server5.theimagehosting.com/image.php?img=rssfeed1.jpg)

I get this error

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fimages5.theimagehosting.com%2Frsserror.th.jpg&hash=689f4a4dc4606c0183fafc133c0c09677951ba7a) (http://server5.theimagehosting.com/image.php?img=rsserror.jpg)

try pasting in the url into your code and see what you get maybe its me but i dont think so.  :o im not sure if the two files are the same but for some reason its reading them differently.  :)
Title: Re: Advanced RSS Feed
Post by: URPG on August 26, 2006, 10:23:56 AM
Seems like the order of information is different in your source. It can find the headlines, but somehow confuses the link for the headline with it's description?

You could give me a link to your source file, then i could try to find out why it's not working like other feeds? But i am not an expert on those rss files themself...
Title: Re: Advanced RSS Feed
Post by: daftdate on August 26, 2006, 11:19:09 AM
This is the link to the rss feed

http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/england/west_midlands/rss.xml

other than this http line i havent changed anything else in your code so am unsure of why its changing it around,
but dont worry if you cant get it working I will just go with the static one.  :) and thanx for all your help.  :)
Title: Re: Advanced RSS Feed
Post by: URPG on August 26, 2006, 12:23:20 PM
Does not look like a real rss feed to me. It's a page with the feeds description, etc. and part of it is the rss feed it seems...

Just open http://rss.cnn.com/rss/cnn_world.rss and take a look at the difference...

But maybe the basic script i used to read the feed cannot handle all formats...
Title: Re: Advanced RSS Feed
Post by: daftdate on August 26, 2006, 07:57:11 PM
Oh right i see what you mean im unsure if you can get that script from the bbc I will have a look around and see what i can try  thanx anyway.  :)
Title: Re: Advanced RSS Feed
Post by: akulion on August 29, 2006, 12:28:19 PM
added to block snippet index
Title: Re: Advanced RSS Feed
Post by: URPG on August 29, 2006, 01:17:20 PM
Thanks!

Now... how about integration?
What's the original doing that this does not, so it can display the BBC stream?
How can i integrate the features into the TP interface so Users don't have to edit them inside the code?
Title: Re: Advanced RSS Feed
Post by: rebelrose on August 31, 2006, 05:51:34 PM
Quote from: Mrs G6 on August 13, 2006, 09:01:53 AM
Try to convert the rss feed to a script instead.
Go to this page and follow the steps and see if you get a better layout on the feed
http://www.rss-to-javascript.com/p/138.html
Then put the feed in a java/html block

I would have loved this type script but I could not get it to generate code. Not sure why.


**************

I got it, it was an operator malfunction   :-\
Title: Re: Advanced RSS Feed
Post by: URPG on September 01, 2006, 04:22:14 AM
Does it actualy look that much better?
Title: Re: Advanced RSS Feed
Post by: moonrock on September 14, 2006, 04:36:06 PM
I hope this is the right place to get help!

I intend to use maxfeeds for ad. but their ad are served in RSS
i was thinking using this block to feed
but i'm confused as i'm noob in this

this is the url to the feed

http://xml.maxfeeds.com/?aff_id=[ACCOUNT]&keyword=adult&ip_addr=[IP ADDRESS]

[ACCOUNT] = my account name
[IP ADDRESS] = client IP

now.. how do i detect or insert the IP of the member ?

according to maxfeeds website, it says

QuoteThis parameter identifies the IP address of the individual performing the query.
In most situations the IP address can be detected from the HTTP request by the REMOTE_ADDR parameter
$_SERVER[REMOTE_ADDR]

$_SERVER[REMOTE_ADDR]

How do i use this ? together with Advanced RSS Feed or Rss readers v1.2 from Tufat
or can I use this on Static Page mod  ?

Thanks for help!
Title: Re: Advanced RSS Feed
Post by: URPG on September 14, 2006, 05:49:38 PM
you could do a trace to your website URL or a whois lookup(?) and you will get it's IP. Account Name is possible your account at maxfeeds?

The only improvements this advanced feed does is allowing you to scroll the news at custom speed with or without stoping the scroll on mouseover. So it does not matter for your feed, it's just a matter of taste and look waht features you want.
Title: Re: Advanced RSS Feed
Post by: moonrock on September 14, 2006, 06:05:06 PM
Quote from: URPG on September 14, 2006, 05:49:38 PM
you could do a trace to your website URL or a whois lookup(?) and you will get it's IP. Account Name is possible your account at maxfeeds?

The only improvements this advanced feed does is allowing you to scroll the news at custom speed with or without stoping the scroll on mouseover. So it does not matter for your feed, it's just a matter of taste and look waht features you want.

thanks for info.

but when maxfeeds says 'This parameter identifies the IP address of the individual performing the query'
does it mean my DNS?.. i thought it should be the forum member's IP.
if it's my host, i can get the IP easily.
but if it's the member's.. how do i put the code to execution ?

yes, the account is my maxfeeds's account name.
Title: Re: Advanced RSS Feed
Post by: IchBin on September 14, 2006, 06:26:16 PM
$_SERVER['REMOTE_ADDR'] is a variable that will load the IP of the person who loads the page. I'm not sure how to use it in the maxfeed.
Title: Re: Advanced RSS Feed
Post by: moonrock on September 14, 2006, 06:33:16 PM
Quote from: IchBinâââ,¬Å¾Ã,¢ on September 14, 2006, 06:26:16 PM
$_SERVER['REMOTE_ADDR'] is a variable that will load the IP of the person who loads the page. I'm not sure how to use it in the maxfeed.

i'm not using in maxfeeds. but maxfeeds need it to use it in my RSS block.
what i need to know is how to code it (i'm noob in coding)

maxfeeds need the IP of the user to display it's feed
and it says it can use $_SERVER[REMOTE_ADDR] to detect the ip
to add the IP at the end of this url..(at the IP ADDRESS)

http://xml.maxfeeds.com/?aff_id=[ACCOUNT]&keyword=adult&ip_addr=[IP ADDRESS]

how do I do that ?

i just did a search and it show it in PHP

$ip = $_SERVER['REMOTE_ADDR'];

does that mean i can just add =$ip at the end of the url ?

and use this line in the block ?

http://xml.maxfeeds.com/?aff_id=[ACCOUNT]&keyword=adult&ip_addr=$ip[/b]
Title: Re: Advanced RSS Feed
Post by: URPG on September 14, 2006, 06:53:00 PM
I don't know if the server does the query, puzzling together the page, then sending it or if the users browser does so. I'd guess the users browser, ten you have to use on of those enviromental variables...
Title: Re: Advanced RSS Feed
Post by: dennishe on October 27, 2006, 07:51:30 AM
Very neat, URPG - thanks a lot for this one.

I have removed the <big></big> around the headlines, because I think it looks better in a side block on my site this way.


Dennis Hestbech, Denmark
Title: Re: Advanced RSS Feed
Post by: URPG on October 27, 2006, 10:03:39 AM
Good to know that i have been of some help :)
Title: Re: Advanced RSS Feed
Post by: dennishe on October 27, 2006, 02:47:19 PM
Well, the least I could do was to express a little grattitude :)

Btw, could it be true (I'm SUCH a PHPn00b, still), that to run more than one of these RSS feeds on a page, I'll need to change the name of the variables ?
(works perfectly in IE, but Firefox2 throws fits when I have more than one feed on a page)

Kind regards,


Dennis
Title: Re: Advanced RSS Feed
Post by: martino on March 04, 2007, 12:11:22 PM
Awesome code, but I'm having problems when trying to display the following feed: http://rss.a.scarywater.net/tag/formulasub.rss

All I get back is a blank box with a title, however the default feed which was in the code works... :/
Title: Re: Advanced RSS Feed
Post by: Gourgi on March 05, 2007, 01:57:59 AM
the script does work with feeds !
my only problems is that my site is in UTF-8 and my feeds are displayed in another encoding (ISO 8859-7) :(
where can i set the default encoding ??
i tried in the updated code http://www.tinyportal.net/index.php?topic=7104.msg60419#msg60419 to put this
echo utf8_encode($output_temp);instead of this echo $output_temp;but didn;t work :(
Title: Re: Advanced RSS Feed
Post by: daygo140 on March 09, 2007, 12:44:13 AM
It all of a sudden totally stopped displaying digg.  I tried putting in my blogs rss (word press) and all it displayed from the feed was the <title> and <comment> tags.  Another words...my Title showed and yes it was correct and clickable and INSTEAD of the description all I got was the URL found in the rss feed's comment tags.

NO DESCRIPTION....DIGG no longer works didn't touch code AT ALL!   I SWEAR!
Title: Re: Advanced RSS Feed
Post by: URPG on March 12, 2007, 12:44:54 PM
I got no idea how to change the charset...

Could this stuff's features be integrated into the flawless default rss-box? It's jsut two lines of code...
Title: Re: Advanced RSS Feed
Post by: Uber_Tiny on April 13, 2007, 12:44:50 AM
Great job!!

I am wondering if there is a way to adjust the font size?

As you can see here > www.geforce3d.net

Yes I am a rookie coder so forgive me if I look over something simple.

Could it be that it is using the fonts size from the site it's self?

Any help is greatly appreciated.
Title: Re: Advanced RSS Feed
Post by: G6Cad on April 13, 2007, 08:22:41 AM
The feed is what it is from the site you get it from. TP just import the info from the feed and display it as is.
So if you want to change anything in the feed, you have to ask on where you got it from.

There is how ever a javascript you can use to "change" the feeds looks, but then you cant use it in an rss feed block, you have to use a javascrip one instead.
http://www.rss-to-javascript.com/p/138.html

Title: Re: Advanced RSS Feed
Post by: URPG on May 14, 2007, 01:34:58 PM
If you do not use the original TP version but this scrolling one, you can change the "big" and "small" tags (see: seflhtml for what to replace them with to fit your size needs).
Title: Re: Advanced RSS Feed
Post by: babiesrar on June 13, 2007, 04:58:56 PM
Thanks for this nice block. But I couldn't use this one. I added your last code as phpbox but it displays only "error ()". What can I do?
Title: Re: Advanced RSS Feed
Post by: Cholo on June 13, 2007, 06:11:49 PM
Anyone have a demo of this on their site i can check out? Thanks. I didn't see it active in any of the links in this thread.
Title: Re: Advanced RSS Feed
Post by: dennishe on June 14, 2007, 10:30:26 PM
Bottom right at:

http://www.2tal-mobility.dk/forum/index.php?PHPSESSID=bb2f4b06e5526cf5415715490c191c1b&cat=6

The RSS feed is Novell's Zenworks Cool Solutions:

http://www.novell.com/newsfeeds/rss/zenworks.xml


The rest of the site is in Danish - have fun :)


Dennis
Title: Re: Advanced RSS Feed
Post by: URPG on July 20, 2007, 11:32:03 PM
Deactivated it because we could not agree on a newsfeed for the front page. But it is working well as you can see :)
Title: Re: Advanced RSS Feed
Post by: Greyhound on August 06, 2007, 03:31:57 AM
How do you change the size of the links?
Title: Re: Advanced RSS Feed
Post by: rjackson on October 02, 2007, 02:52:19 PM
Can someone help me with this error ? -

Parse error: parse error, unexpected T_STRING  /Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 54

I have copied the script exactly how he had it listed show here


//RSS Newsreader

  $backend = "http://wowvault.ign.com/show_rss.php";
  $max_items = 16;
  $items = 0;
  $scroll = 1; //1 for scrolling box 0 for no scrolling
  $amount = 1; //pixels per scroll step
  $delay = 25; //step delay ms
  $stop = 1; //1 for scroll stop on mouseover 0 for no stop

  if($scroll==0)$stop=0; //no scrollstop if no scrolling

  $output_temp = "<b>WOW Vault News Feed:</b><br>";

//add marquee tag if scrolling is enabled
  if($scroll) $output_temp .="<marquee direction=up scrolldelay=$delay scrollamount=$amount height=200 ";

//only add mouse events if wanted
  if($stop) $output_temp .="onmouseout=this.start() onmouseover=this.stop()><br><br><br><br><br><br><br>"; else $output_temp .="><br><br><br><br><br><br><br><br>";

  $fpread = fopen($backend, 'r');
  if(!$fpread) {
      echo "error $errstr ($errno)<br>\n";
      exit;
  } else {

       while(! feof($fpread) ) {

          $buffer = ltrim(Chop(fgets($fpread, 256)));

          if (($buffer == "<item>") && ($items < $max_items)) {
            $title = ltrim(Chop(fgets($fpread, 256)));
            $link = ltrim(Chop(fgets($fpread, 256)));
            $description = ltrim(Chop(fgets($fpread, 256)));

            $title = ereg_replace( "<title>", "", $title );
            $title = ereg_replace( "</title>", "", $title );
            $link = ereg_replace( "<link>", "", $link );
            $link = ereg_replace( "</link>", "", $link );
            $description = ereg_replace( "<description>", "", $description );
            $description = ereg_replace( "</description>", "", $description );     

            $output_temp .= "<a href=\"".$link."\" target=_blank><b><big>".$title."</big></b></a><br><small>".$description."</small><br>";
            $items++;
          }
      }
      fclose($fpread);
  }

// alle daten sind in $ausgabe_temp
echo $output_temp;
echo '<br><br><br><br><br><br><br><br><br><br></marquee>';

Not all of this is my code, i took a very basic "rss to your website" thingy from some tutorial and heavilie modified it...

what did I do wrong?


Title: Re: Advanced RSS Feed
Post by: rjackson on October 08, 2007, 12:22:41 AM
anyone have any ideals?
Title: Re: Advanced RSS Feed
Post by: IchBin on October 10, 2007, 03:03:04 AM
The code you just posted doesn't look anything like the OP code.
Title: Re: Advanced RSS Feed
Post by: rjackson on October 10, 2007, 04:10:16 AM
thats the code I got from page 2 of this thread

Title: Re: Advanced RSS Feed
Post by: IchBin on October 10, 2007, 01:52:21 PM
Well I just copy/pasted the code into a phpbox on my site and it worked just fine. Please remember to use code tags when posting code.
Title: Re: Advanced RSS Feed
Post by: 3nd3r on March 31, 2008, 05:23:58 PM
Hello
I'm using this block code in various blocks in my web.
The problem is that when it picks a rss feed that's not working (e.g. a webpage that's down) the entire site (my site) is ralentized, until the point it returns anything.

So, my question is:
Is there a way to check rss feed source before process it, to prevent this possibility? Maybe an 'echo' telling that (something like 'rss source not found')?

Thanks in advance.
Title: Re: Advanced RSS Feed
Post by: IchBin on March 31, 2008, 06:01:05 PM
This is one of those things that I wish we had as well. Unfortunately, I don't know of any way to do that myself.
Title: Re: Advanced RSS Feed
Post by: 3nd3r on March 31, 2008, 06:15:30 PM
Well, let's use some of that 'essay and error' working mode to see if anything works... :P  ;)

Let's try first "if exists..." or maybe a "curl"...

I will tell here if I get it  :up:
Title: Re: Advanced RSS Feed
Post by: morskisrle on April 08, 2008, 07:45:21 PM
What line of code should i put i in order to encode the letters in utf8?
Title: Re: Advanced RSS Feed
Post by: 3nd3r on April 09, 2008, 06:21:07 AM
What I've done is put what I want to be UTF-8 inside this:
utf8_encode(HERE THE CODE YOU WANT IN utf8)
Title: Re: Advanced RSS Feed
Post by: MargateSteve on April 13, 2008, 10:54:44 PM
Right, I tried to sort this on my own but have got nowhere!
I have used this code at http://margate.wsnw.net top left in a block called 'margate-fc.com' and although it is working it is only picking up 1 post in the feed.
A few blocks below that in 'Latest headlines from www.margate-fc.com... ' all the posts from the same feed are showing up.
Any advice on where I am going wrong would be greatfully recieved!
Steve
Title: Re: Advanced RSS Feed
Post by: MargateSteve on April 16, 2008, 06:35:01 PM
I have just re-read my post and got a bit worried that it was a bit criticle in some way! Just in case people have ignored it for that reason let me reassure that that is not the case. Basically I like to try to solve problems like this myself before asking a question, which is why the post started off the way it did.
Anyway, by way of an update, the output from the feed has changed twice in the last two days and although it has picked up the new story each time, it will still only show the newest one in the block.
I am sure that I am missing something simple here!
Steve
Title: Re: Advanced RSS Feed
Post by: thefley on August 09, 2008, 03:40:38 AM
the code you posted on page one works just find for me on IE7 and FireFox

demo www.gpriders.com

Just one thing, is there a way to make the links open in a new window ??


code used:
//RSS Newsreader

  $backend = "http://rss.cnn.com/rss/cnn_world.rss";
  $max_items = 10;
  $items = 0;
  $ausgabe_temp = "<b>CNN-World Newsfeed:</b><br><marquee direction=up scrolldelay=3 scrollamount=1 height=16 onmouseout=this.start() onmouseover=this.stop()>";

  $fpread = fopen($backend, 'r');
  if(!$fpread) {
      echo "error $errstr ($errno)<br>\n";
      exit;
  } else {

       while(! feof($fpread) ) {

          $buffer = ltrim(Chop(fgets($fpread, 256)));

          if (($buffer == "<item>") && ($items < $max_items)) {
            $title = ltrim(Chop(fgets($fpread, 256)));
            $link = ltrim(Chop(fgets($fpread, 256)));
            $description = ltrim(Chop(fgets($fpread, 256)));

            $title = ereg_replace( "<title>", "", $title );
            $title = ereg_replace( "</title>", "", $title );
            $link = ereg_replace( "<link>", "", $link );
            $link = ereg_replace( "</link>", "", $link );
            $description = ereg_replace( "<description>", "", $description );
            $description = ereg_replace( "</description>", "", $description );     

            $ausgabe_temp .= "<a href=\"".$link."\"><b><big>".$title."</big></b></a><br><small>".$description."</small><br>";
            $items++;
          }
      }
      fclose($fpread);
  }

// alle daten sind in $ausgabe_temp
echo $ausgabe_temp;
echo '</marquee>';
Title: Re: Advanced RSS Feed
Post by: IchBin on August 09, 2008, 05:43:27 AM
Change this code:

$ausgabe_temp .= "<a href=\"".$link."\"><b><big>".$title."</big></b></a><br><small>".$description."</small><br>";

To this:

$ausgabe_temp .= "<a target=\"_blank\" href=\"".$link."\"><b><big>".$title."</big></b></a><br><small>".$description."</small><br>";
Title: Re: Advanced RSS Feed
Post by: thefley on August 09, 2008, 08:03:19 PM
got myself an error when I did it....


Parse error: parse error, unexpected T_STRING in /home/content/h/e/f/hefleys/html/smf/Sources/Load.php(1802) : eval()'d code(35) : eval()'d code on line 30
Title: Re: Advanced RSS Feed
Post by: IchBin on August 10, 2008, 01:56:38 AM
Try the above code again.
Title: Re: Advanced RSS Feed
Post by: doughboy99 on November 21, 2008, 09:22:47 PM
Could someone help wit this please?

I am using TP.1.0.6 and SMF 1.17. I am getting this error when I put this code in a phpbox

Parse error: syntax error, unexpected T_CONCAT_EQUAL in path removed/forum/Sources/Load.php(1745) : eval()'d code(43) : eval()'d code on line 18

line 18 is

if($scroll) output_temp .="<marquee direction=up scrolldelay=$delay scrollamount=$amount height=$height ";

Title: Re: Advanced RSS Feed
Post by: G6Cad on November 21, 2008, 09:29:10 PM
Have no idea on how to help you with that, you dont give any info what so ever
And how is this related to the RSS feed ??
Title: Re: Advanced RSS Feed
Post by: IchBin on November 21, 2008, 09:32:17 PM
In addition to answering what G6 said, please post the full code and post the code in the BBC [code ] brackets.
Title: Re: Advanced RSS Feed
Post by: doughboy99 on November 21, 2008, 10:49:19 PM
Apologies.

Using the code below from page two this topic in a php

//RSS Newsreader

  $backend = "http://rss.cnn.com/rss/cnn_world.rss";
  $headline = "CNN World News";
  $max_items = 16;
  $items = 0;
  $height = 200;
  $scroll = 1; //1 for scrolling box 0 for no scrolling
  $amount = 1; //pixels per scroll step
  $delay = 25; //step delay ms
  $stop = 1; //1 for scroll stop on mouseover 0 for no stop

  if($scroll==0)$stop=0; //no scrollstop if no scrolling

  $output_temp = "<b> $headline </b><br>";

//add marquee tag if scrolling is enabled
  if($scroll) output_temp .="<marquee direction=up scrolldelay=$delay scrollamount=$amount height=$height ";

//only add mouse events if wanted
  if($stop) $output_temp .="onmouseout=this.start() onmouseover=this.stop()>"; else $output_temp .=">";

  $fpread = fopen($backend, 'r');
  if(!$fpread) {
      echo "error $errstr ($errno)<br>\n";
      exit;
  } else {

       while(! feof($fpread) ) {

          $buffer = ltrim(Chop(fgets($fpread, 256)));

          if (($buffer == "<item>") && ($items < $max_items)) {
            $title = ltrim(Chop(fgets($fpread, 256)));
            $link = ltrim(Chop(fgets($fpread, 256)));
            $description = ltrim(Chop(fgets($fpread, 256)));

            $title = ereg_replace( "<title>", "", $title );
            $title = ereg_replace( "</title>", "", $title );
            $link = ereg_replace( "<link>", "", $link );
            $link = ereg_replace( "</link>", "", $link );
            $description = ereg_replace( "<description>", "", $description );
            $description = ereg_replace( "</description>", "", $description );     

            $output_temp .= "<a href=\"".$link."\"><b><big>".$title."</big></b></a><br><small>".$description."</small><br>";
            $items++;
          }
      }
      fclose($fpread);
  }

// alle daten sind in $ausgabe_temp
echo $output_temp;
echo '</marquee>';


generates this

Parse error: syntax error, unexpected T_CONCAT_EQUAL in "path removed"/Sources/Load.php(1745) : eval()'d code(43) : eval()'d code on line 18

in the phpbox when it is displayed.

Line 18 is

if($scroll) output_temp .="<marquee direction=up scrolldelay=$delay scrollamount=$amount height=$height ";

Title: Re: Advanced RSS Feed
Post by: doughboy99 on November 22, 2008, 12:47:52 AM
Resolved this. The code on page 2 seems to be missing a $ symbol

if($scroll) output_temp .="<marquee direction=up scrolldelay=$delay scrollamount=$amount height=$height ";

should be
if($scroll) $output_temp .="<marquee direction=up scrolldelay=$delay scrollamount=$amount height=$height ";

now just need to get it display my feed.
Title: Re: Advanced RSS Feed
Post by: Nr|Five on February 15, 2009, 08:09:42 PM
Great piece of code URPG kudos on that.

Got a question though. Both the title and description is being posted atm. In the description text I often have URLs. Only those are not clickable. Anyone here know a solution to that problem?

// Nr|Five
Title: Re: Advanced RSS Feed
Post by: Denniga on February 21, 2009, 09:01:37 PM
Is it possible to have the block filled with text, and then begin scrolling?

Because right now, the block is empty and then scrolling begins.

If you want to see the implementation on our site, check out: www.nphscs.com