About RSS feed integration

Advert test
#1
Hi folks,


I'm prepared publishing RSS feed from other websites w/o modified but have no idea how to start. On Internet browsing I discovered some websites mentioning "sign the contract and you'll have news publishing on your website in 5 minutes". I hesitate whether it would be so easy. Just signing the contract and providing them email address and my website URL then I'm done.


I built my website on HTML, CSS and Javascript. I have text scroller/marquee running on the website built on javascript modified on Cross Browser marquee;
Dynamic Drive DHTML Scripts- Cross Browser marquee

and Cross Browser marquee II;
Dynamic Drive DHTML Scripts- Cross Browser marquee II


I don't know whether I can make use of them to run news. If YES, can you advise how to integrate them to the RSS feed websites? TIA


B.R.
satimis
 
#3
Not quite clear what you want to do here ,
If you want to set up an Rss feed on your site.
have a look at this post http://www.irishwebmasterforum.com/coding-help/2918-setting-up-rss-feeds.html
Hi ghost,


Thanks for your URL.


Actually I'm confused. What I need is to integrate RSS feed news to my website which is hoisted on my own server, so that visitors while browsing my website can read news on their PCs. I have been googling a couple days reading many articles on Internet. But the more I read more confused I'm. I don't know whether I need an aggregator only. I'm not prepared to modify the feed news nor to add news to the feed.


If the feeds include vedio clips can the visitors display vedio on their PCs?


I have scoller/text marquee running on my website. The same is modified on;

Cross Browser marquee
Cross Browser marquee II

Dynamic Drive DHTML Scripts- Cross Browser marquee
Dynamic Drive DHTML Scripts- Cross Browser marquee II


They are written in javascript. Whether I can make use of them. If YES, then HOW? TIA


B.R.
satimis
 
#4
last rss

I use the lastRSS download it from Last RSS - PHP RSS parser/reader the zip contains one file lastRSS.php upload this unchanged to your php enabled server.now go to the page you want to display feeds on and place the following code where you want to display the feed.

Code:
<?php
function ShowOneRSS($url) {
global $rss;
if ($rs = $rss->get($url)) {
echo '<h2><a href="'.$rs['link'].'">'.$rs['title']."</a></h2>\n";
echo $rs['description']."<br>\n";
echo "<ul>\n";
foreach ($rs['items'] as $item) {
echo '<li><a href="'.$item['link'].'" title="'.$item['description'].'">'.$item['title'].'</a></li>';
}
if ($rs['items_count'] <= 0) { echo "<li>Sorry, no items found in the RSS file :-(</li>"; }
echo "</ul>\n";
}
}
// ===
// include lastRSS
include "lastRSS.php";
// List of RSS URLs
$rss_left = array(
'http://www.rte.ie/rss/gaa.xml',
);
$rss_right = array(
'http://www.independent.ie/sport/hurling/rss'
);
// Create lastRSS object
$rss = new lastRSS;
// Set cache dir, cache interval and character encoding
$rss->cache_dir = 'cache';
$rss->cache_time = 14000; // (4hrs)
$rss->cp = '';
$rss->items_limit = 5;
// Show all rss files
echo '<table class="rss_section" cellpadding="5" border="0"><tr><td width="50%" valign="top">';
foreach ($rss_left as $url) ShowOneRSS($url);
echo '</td><td width="50%" valign="top">';
foreach ($rss_right as $url) ShowOneRSS($url);
echo '</td></tr></table>';
?>
save your page with a .php extension you should now have feeds
modify the above code to suit your needs i mean feeds .

JS marquee cant help you there ,

fire away with the above let us know how you get on.
Mick
 
#5
I use the lastRSS download it from Last RSS - PHP RSS parser/reader the zip contains one file lastRSS.php upload this unchanged to your php enabled server.now go to the page you want to display feeds on and place the following code where you want to display the feed.

Code:
<?php
function ShowOneRSS($url) {
global $rss;
if ($rs = $rss->get($url)) {
echo '<h2><a href="'.$rs['link'].'">'.$rs['title']."</a></h2>\n";
echo $rs['description']."<br>\n";
echo "<ul>\n";
foreach ($rs['items'] as $item) {
echo '<li><a href="'.$item['link'].'" title="'.$item['description'].'">'.$item['title'].'</a></li>';
}
if ($rs['items_count'] <= 0) { echo "<li>Sorry, no items found in the RSS file :-(</li>"; }
echo "</ul>\n";
}
}
// ===
// include lastRSS
include "lastRSS.php";
// List of RSS URLs
$rss_left = array(
'http://www.rte.ie/rss/gaa.xml',
);
$rss_right = array(
'http://www.independent.ie/sport/hurling/rss'
);
// Create lastRSS object
$rss = new lastRSS;
// Set cache dir, cache interval and character encoding
$rss->cache_dir = 'cache';
$rss->cache_time = 14000; // (4hrs)
$rss->cp = '';
$rss->items_limit = 5;
// Show all rss files
echo '<table class="rss_section" cellpadding="5" border="0"><tr><td width="50%" valign="top">';
foreach ($rss_left as $url) ShowOneRSS($url);
echo '</td><td width="50%" valign="top">';
foreach ($rss_right as $url) ShowOneRSS($url);
echo '</td></tr></table>';
?>
save your page with a .php extension you should now have feeds
modify the above code to suit your needs i mean feeds .

JS marquee cant help you there ,

fire away with the above let us know how you get on.
Mick
Thanks for your advice.


On which directory shall I install "ast RSS-PHP RSS parser"? On /var/www/my_webpage.index.html ? I'm running Ubuntu 7.04 server amd64. This is a test. I have only a single page my_webpage.index.html


On where shall I copy your code? <body>your code</body>? If saving the webpage as .php NOT .html can visitor evokes it on browsing my site? Thanks


B.R.
satimis
 
#7
You dont need to install this to use lastRSS


yes you can place it in the the between the body tags

For the purpose of your test save the page as index.php
Performed following test.

Download "lastRSS.zip" (Last RSS-PHP RSS parser/reader) on;
Last RSS - PHP RSS parser/reader

unzip the package

$ sudo mv lastRSS.php /var/www/

$ sudo nano /var/www/index.html
typing your php script on <body> </body>

and saving the file as "index.php"

$ ls /var/www/ | grep index
index.php


On a workstation brower

It displays following news line on the webpage;
Code:
[B][URL="http://www.rte.ie/rss/gaa.xml"]RTÉ Sport - GAA News[/URL][/B]

 Latest Irish and international news supplied by RTE.ie[LIST]
[*][URL="http://www.rte.ie/sport/gaa/2008/0311/gpa.html?rss"]'Pay for play only a matter of time': O'Neill[/URL]
[*][URL="http://www.rte.ie/sport/gaa/2008/0311/handball.html?rss"]Irish handballers set for Carlow showdown[/URL]
[*][URL="http://www.rte.ie/sport/gaa/2008/0310/camogie.html?rss"]Weekend camogie round-up[/URL]
[*][URL="http://www.rte.ie/sport/gaa/2008/0310/handball.html?rss"]Handball quarter finals produce dramatic ties[/URL]
[*][URL="http://www.rte.ie/sport/gaa/2008/0309/galwaytipperary.html?rss"]Galway 0-16 Tipperary 0-16[/URL][/LIST][B][URL="http://www.independent.ie/sport/hurling/?service=Rss"]Independent.ie - Hurling RSS Feed[/URL][/B][LIST]
[*][URL="http://www.independent.ie/sport/hurling/skerries-launch-centenary-with-clash-of-old-guard-1314066.html?r=RSS"]Skerries launch centenary with clash of old guard[/URL]
[*][URL="http://www.independent.ie/sport/hurling/model-forward-jordan-calls-time-on-county-career-1314067.html?r=RSS"]Model forward Jordan calls time on county career[/URL]
[*][URL="http://www.independent.ie/sport/hurling/meyler-admits-to-harsh-words-after-thumping-1313120.html?r=RSS"]Meyler admits to harsh words after thumping[/URL]
[*][URL="http://www.independent.ie/sport/gaelic-football/king-and-doyle-goals-net-victory-against-spirited-exiles-1312053.html?r=RSS"]King and Doyle goals net victory against spirited Exiles[/URL]
[*][URL="http://www.independent.ie/sport/hurling/power-points-the-way-as-cats-rout-pathetic-wexford-1312090.html?r=RSS"]Power points the way as Cats rout pathetic Wexford[/URL][/LIST]
Thanks


Havd following questions;

1)
The news lines are static. How to make the news lines scrolling on a box?

2)
Can I add another RSS feed? I.E. 2 feeds on the same webpage?

3)
OR if 2) above is impossible, then how to change the feed?


TIA


B.R.
satimis
 
#8
RSS Revisited

Can I add another RSS feed? I.E. 2 feeds on the same webpage?
You can add a comma seperated list of feeds at this point note no comma after the last one
Code:
// List of RSS URLs
$rss_left = array(
'http://www.rte.ie/rss/gaa.xml',
'http://www.freshfolder.com/rss.php',
'http://www.kinomol.cz/rss.php'
OR if 2) above is impossible, then how to change the feed?
Code:
// List of RSS URLs
$rss_left = array(
'http://www.rte.ie/rss/gaa.xml',
you can also edit your list from here
The news lines are static. How to make the news lines scrolling on a box?
for the scroller you will need to remove the right side feeds remove these two lines from the php code
Code:
foreach ($rss_right as $url) ShowOneRSS($url);
echo '</td></tr></table>';
now set up your JS in the page header
and in the body set up your marquee
Code:
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
place your php code here
</div>
</div>
probebley not the best Solution out there but its a start
Mick
 
#9
You can add a comma seperated list of feeds at this point note no comma after the last one
Code:
// List of RSS URLs
$rss_left = array(
'http://www.rte.ie/rss/gaa.xml',
'http://www.freshfolder.com/rss.php',
'http://www.kinomol.cz/rss.php'
It works. Thanks. But the last URL doesn't work, no such "rss.php" file.


Code:
// List of RSS URLs
$rss_left = array(
'http://www.rte.ie/rss/gaa.xml',
you can also edit your list from here
It also works


for the scroller you will need to remove the right side feeds remove these two lines from the php code
Code:
foreach ($rss_right as $url) ShowOneRSS($url);
echo '</td></tr></table>';
now set up your JS in the page header
and in the body set up your marquee
Code:
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
place your php code here
</div>
</div>
probebley not the best Solution out there but its a start
It doesn't work.

No marquee container/box displayed and no text scrolling.

All texts below this script are pushed to the right, leaving half page on the left of the webpage empty.

Script
Code:
<?php
function ShowOneRSS($url) {
global $rss;
if ($rs = $rss->get($url)) {
echo '<h2><a href="'.$rs['link'].'">'.$rs['title']."</a></h2>\n";
echo $rs['description']."<br>\n";
echo "<ul>\n";
foreach ($rs['items'] as $item) {
echo '<li><a href="'.$item['link'].'" title="'.$item['description'].'">'.$item['title'].'</a></li>';
}
if ($rs['items_count'] <= 0) { echo "<li>Sorry, no items found in the RSS file :-(</li>"; }
echo "</ul>\n";
}
}
// ===
// include lastRSS
include "lastRSS.php";
// List of RSS URLs
$rss_left = array(
'http://www.rte.ie/rss/gaa.xml',
'http://www.freshfolder.com/rss.php'
);
$rss_right = array(
'http://www.independent.ie/sport/hurling/rss'
);
// Create lastRSS object
$rss = new lastRSS;
// Set cache dir, cache interval and character encoding
$rss->cache_dir = 'cache';
$rss->cache_time = 14000; // (4hrs)
$rss->cp = '';
$rss->items_limit = 5;
// Show all rss files
echo '<table class="rss_section" cellpadding="5" border="0"><tr><td width="50%" valign="top">';
foreach ($rss_left as $url) ShowOneRSS($url);
echo '</td><td width="50%" valign="top">';
foreach ($rss_right as $url) ShowOneRSS($url);
echo '</td></tr></table>';
?>

Edit:

Would my existing marquee cause the problem?


B.R.
satimis
 
#10
for the scroller you will need to remove the right side feeds remove these two lines from the php code
Code:
foreach ($rss_right as $url) ShowOneRSS($url);
echo '</td></tr></table>';
Place the js code in the <head> HERE </head>of your doc
Remove the above 2 lines of code its near the bottom of the PHP script.
in the <body> Put
Code:
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
place the complete php script here
</div>
</div>
Just ran it on my own localhost and it works fine
needs a bit of CSS to spruce it up a bit

OK
 
#11
for the scroller you will need to remove the right side feeds remove these two lines from the php code
Code:
foreach ($rss_right as $url) ShowOneRSS($url);
echo '</td></tr></table>';
Place the js code in the <head> HERE </head>of your doc
Remove the above 2 lines of code its near the bottom of the PHP script.
in the <body> Put
Code:
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
place the complete php script here
</div>
</div>
Just ran it on my own localhost and it works fine
Sorry, still fail

$ cat /var/www/index.php
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"https://www.satimis.com/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<center>
<script language="JavaScript1.2">
//Specify the marquee's width (in pixels)
var marqueewidth="600px"
//Specify the marquee's height
var marqueeheight="50px"
//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=2
//configure background color:
var marqueebgcolor="#DEFDD9"
//Pause marquee onMousever (0=no. 1=yes)?
var pauseit=1


//Specify the marquee's content (don't delete <nobr> tag)
//Keep all content on ONE line, and backslash any single quotations (ie: that\'s great):

var marqueecontent='<nobr><h><tags style="word-spacing:25px;"><strong>Tokyo NewYork Paris HongKong London Sydney Soeul Frankfurt SanFrancisco Singapore Taiwan Shanghai KualaLupur Mexico Jakata</strong></tags></h></nobr>'


////NO NEED TO EDIT BELOW THIS LINE////////////
marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>')
var actualwidth=''
var cross_marquee, ns_marquee

function populate(){
if (iedom){
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
cross_marquee.innerHTML=marqueecontent
cross_marquee.style.border='.0625ex solid red';
cross_marquee.style.top=parseInt(marqueeheight)/2-cross_marquee.offsetHeight/2+'px';
cross_marquee.style.border='none';
actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
}
else if (document.layers){
ns_marquee=document.ns_marquee.document.ns_marquee2
ns_marquee.left=parseInt(marqueewidth)+8
ns_marquee.document.write(marqueecontent)
ns_marquee.document.close()
actualwidth=ns_marquee.document.width
}
lefttime=setInterval("scrollmarquee()",20)
}
window.onload=populate

function scrollmarquee(){
if (iedom){
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
else
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"

}
else if (document.layers){
if (ns_marquee.left>(actualwidth*(-1)+8))
ns_marquee.left-=copyspeed
else
ns_marquee.left=parseInt(marqueewidth)+8
}
}

if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';border:blue dotted 2px;overflow:hidden">')
//write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
write('<div id="iemarquee" style="position:absolute;left:0px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
write('<layer name="ns_marquee2" lefft=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
</script>
</center>
<br>
<br>

    <title>Common Tests</center></title>

<style>
h { font-size: 25px; font-family: sans-serif; font-style: italic; color: rgb(0, 100, 0); }
</style>


</head>

<br>
<body background="greece_w.jpg">
<H1><FONT SIZE="+4"><FONT COLOR="red"><center><I>Common Test</I></center></FONT></FONT></H1>


<br>
<br>
<p>
<center><img src="WELCOME2.gif" height="44" width=150"></center>
</p>

<br>
<br>
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
<?php
function ShowOneRSS($url) {
global $rss;
if ($rs = $rss->get($url)) {
echo '<h2><a href="'.$rs['link'].'">'.$rs['title']."</a></h2>\n";
echo $rs['description']."<br>\n";
echo "<ul>\n";
foreach ($rs['items'] as $item) {
echo '<li><a href="'.$item['link'].'" title="'.$item['description'].'">'.$item['title'].'</a></li>';
}
if ($rs['items_count'] <= 0) { echo "<li>Sorry, no items found in the RSS file :-(</li>"; }
echo "</ul>\n";
}
}
// ===
// include lastRSS
include "lastRSS.php";
// List of RSS URLs
$rss_left = array(
'http://www.rte.ie/rss/gaa.xml',
);
$rss_right = array(
'http://www.independent.ie/sport/hurling/rss'
);
// Create lastRSS object
$rss = new lastRSS;
// Set cache dir, cache interval and character encoding
$rss->cache_dir = 'cache';
$rss->cache_time = 14000; // (4hrs)
$rss->cp = '';
$rss->items_limit = 5;
// Show all rss files
echo '<table class="rss_section" cellpadding="5" border="0"><tr><td width="50%" valign="top">';
foreach ($rss_left as $url) ShowOneRSS($url);
echo '</td><td width="50%" valign="top">';
?>
</div>
</div>
........
........
No marquee container. All texts below are pushed to the right leaving half page empty.


How to get my own marquee displayed under the topic "Commone Test"? Now it is on top of the title. Thanks


B.R.
satimis
 
#12
sorry satimis
bit of confusion here
you are working with Cross Browser marquee
and I am on Cross Browser marquee II I just assumed II was a newer version.
I will attach the code for the one I tested the file is a .txt you need to change this to .php to use it .

I an unable right now to get the other one working maybe someone with some js expertise might have a look at it.
 
#13
sorry satimis
bit of confusion here
you are working with Cross Browser marquee
and I am on Cross Browser marquee II I just assumed II was a newer version.
I will attach the code for the one I tested the file is a .txt you need to change this to .php to use it .

I an unable right now to get the other one working maybe someone with some js expertise might have a look at it.
Hi ghost,


I tried your new_test.txt. The whole webpage is scrolling NOT only the news line.

I'll come back if I discover the solution. Anyway thanks for your help.


B.R.
satimis
 
#14
Solved

Hi ghost,


Problem solved as follow;

Use "Cross Browser marquee II"
Dynamic Drive DHTML Scripts- Cross Browser marquee II


With your php script to replace:
Code:
Your scroller contents
Must retain the last 2 lines
Code:
foreach ($rss_right as $url) ShowOneRSS($url);
echo '</td></tr></table>';
Otherwise the whole website will scroll.

Increase the width of the marquee container then done.


About font size of news, <h7>/<h8>/<h9> makes not much difference. How to further decrease the font size?


The same method can't apply on "Cross Browser marquee".


I'm now searching the solution to run multiple marguee on same page.


B.R.
satimis
 
#15
I see my mistake
should have removed these two , a slip of the mouse

echo '</td><td width="50%" valign="top">';
foreach ($rss_right as $url) ShowOneRSS($url);

and left this one

echo '</td></tr></table>';

:eek:
 
#16
I see my mistake
should have removed these two , a slip of the mouse

echo '</td><td width="50%" valign="top">';
foreach ($rss_right as $url) ShowOneRSS($url);

and left this one

echo '</td></tr></table>';
Your advice works. Thanks. But the rss_right URL disappears.


How to modify the php script removing rss_right, putting the URL (Independent.ie - Hurling RSS Feed) on rss-left.

Remark: This time there will be no rss_left/right.

TIA


B.R.
satimis
 
#18
First is a one column
It works. Thanks.


Before reading your posting. I tried it myself w/o success. The difference I made were;

1)
$rss_left = array(
Code:
$rss = array(
w/o "_left"

2)
foreach ($rss_left as $url) ShowOneRSS($url);
Code:
foreach ($rss as $url) ShowOneRSS($url);
also w/o "_left"


In my consideration there is only one column. I don't need "_left"

But failed. Why?


How to add an additional blank/white column between each channel? Thanks.


Second is a two column
The script works w/o problem.


Edit: How to increase the space btw columns


B.R.
satimis
 
#20
How to increase the space btw columns
The news feed is contained in a ul so you could set a bottom padding for the ul
with css , you will need to style up your scroller to blend in to your page design anyway.

when are we going to see this in the site review forum ??
 
Top