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:
- read external RSS
- have a steady headline and scroll the messages
- Links and Title are Big, Summary is small
- It does stop when you move your mouse into it and continue on if you remove it
//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
URPG.
Where did you get and do the Langage Translate deal?
crip
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...
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??
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!
Nice work, though there is a small problem. In the Opera browser the mouseover doesn't stop the scrolling.
Sounds like a personal problem to me. :P
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
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:
Do you have the <Iframe Height="100%"... ?
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?
You could try that yes.
Maybe you can try it in a leftside or rightside block..might work?
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:
can you put rss feed in an iframe?...I'm not sure?
try a <div tag before and after </div>
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 :(
Thats higher than it was..just increase the height a bit at a time
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:
- Still not able to set $height in percent, no idea why...
- Scrolling is still 'jumping' at the end of one circle, maybe add some empty items?
- Needs full integration (replace momentary rss box, needs to get the abouve variables from block admin menue like the original thing gets RSS source?)
- Maybe add something to clean up the text from special characters like ÃÆ'Ã...¸ or ö or ÃÆ'Ã,¤ that could be displayed messy
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)?
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
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....?
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 :)
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!!!
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 :-/
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.
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?
PERFECT....!!!
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.
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?
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....!
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...
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.
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?
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. :)
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...
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. :)
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...
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. :)
added to block snippet index
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?
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 :-\
Does it actualy look that much better?
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!
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.
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.
$_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.
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]
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...
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
Good to know that i have been of some help :)
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
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... :/
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 :(
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!
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...
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.
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
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).
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?
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.
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
Deactivated it because we could not agree on a newsfeed for the front page. But it is working well as you can see :)
How do you change the size of the links?
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?
anyone have any ideals?
The code you just posted doesn't look anything like the OP code.
thats the code I got from page 2 of this thread
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.
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.
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.
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:
What line of code should i put i in order to encode the letters in utf8?
What I've done is put what I want to be UTF-8 inside this:
utf8_encode(HERE THE CODE YOU WANT IN utf8)
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
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
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>';
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>";
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
Try the above code again.
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 ";
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 ??
In addition to answering what G6 said, please post the full code and post the code in the BBC [code ] brackets.
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 ";
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.
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
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