Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

stuck at adding a RSS ticker to template

Go to End

5 Posts   1414 Views


Community Member, 68 Posts

17 August 2009 at 5:58am

I am stuck at adding that RSS ticker JS to template.
Would really appreciate if somebody could let me know what am i doing wrong, as I've been scratching my head on this for whole weekend ! :)

Here's what i did so far:

To mysite/javascript I have put two files: rssticker.js and direction in mysite/javascript/lastrss/ with bridge.php and lastRSS.php files

To my theme/client/templates/ i have put in <head>:

<script src="mysite/javascript/rssticker.js" type="text/javascript">

* Advanced RSS Ticker (Ajax invocation)- © Dynamic Drive DHTML code library (
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at for this script and 100s more


<style type="text/css">

/*Sample CSS to style the two tickers in the demo*/

width: 400px;
padding: 5px;
background-color: #F3F3F3;
border: 1px solid black;
margin-bottom: 1em;
filter:progid:DXImageTransform.Microsoft.alpha(opacity=80); /*Specify fade effect in IE. Remove if desired.*/
-moz-opacity: 0.8; /*Specify fade effect in Firefox. Remove if desired.*/

.cnnclass a{
text-decoration: none;

width: 400px;
padding: 6px;
background-color: lightyellow;
border: 1px solid #004A00;

.rsstitle{ /*shared class for all title elements in an RSS feed*/
font-weight: bold;

.rssdate{ /*shared class for all date elements in an RSS feed*/
color: gray;
font-size: 85%;

.rssdescription{ /*shared class for all description elements in an RSS feed*/


And in <body>:

<div style="height: 150px">
<script type="text/javascript">
//rssticker_ajax(RSS_id, cachetime, divId, divClass, delay, optionalswitch)
//1) RSS_id: "Array key of RSS feed in PHP script"
//2) cachetime: Time to cache the feed in minutes (0 for no cache)
//3) divId: "ID of DIV to display ticker in. DIV dynamically created"
//4) divClass: "Class name of this ticker, for styling purposes"
//5) delay: delay between message change, in milliseconds
//6) optionalswitch: "optional arbitrary" string to create additional logic in call back function

document.write("CNN News: (Fade Effect enabled. Title+date shown)")
new rssticker_ajax("CNN", 600, "cnnbox", "cnnclass", 3000, "date")

document.write("<br />BBC News: (Title+date+description shown)")
new rssticker_ajax("BBC", 1200, "ddbox", "bbcclass", 3500, "date+description")


This causes that new div to appear on website. I can see that rssticker.js from <head> and the script from <body> are both visible in firebug. All connections to those other php files, Im calling in using /mysite/javascript/ path with site root defined.

I cant make those feeds to appear on my site.

The RSS JS files are taken from:

Please help ! Im desperate!



Forum Moderator, 5523 Posts

17 August 2009 at 9:15am

Are you trying to use BlackCandy or serving your template as xml?. document.write will not work if this is the case.


Community Member, 68 Posts

17 August 2009 at 6:57pm

Hi Willr,
i am not using blackcandy (i have rewritten template based on paddygreen theme idea) at

My header has:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns="" xml:lang="en" >

If xml doesnt allow document.write, what do you suggest? At the moment, im using generator that creates an iframe which i added to sidebar.



Forum Moderator, 5523 Posts

17 August 2009 at 7:01pm

Remove this line

<?xml version="1.0" encoding="UTF-8"?> 

and it should work


Community Member, 68 Posts

17 August 2009 at 7:06pm

removed the line and feed forms were displayed but inside i got:

CNN News: (Fade Effect enabled. Title+date shown)
Error fetching remote RSS feed!