Jump to:

22977 Posts in 11742 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » stuck at adding a RSS ticker to template

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

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

Page: 1
Go to End
Author Topic: 1038 Views
  • qlex
    Avatar
    Community Member
    68 Posts

    stuck at adding a RSS ticker to template Link to this post

    Hi,
    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/Page.ss i have put in <head>:

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

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

    </script>

    <style type="text/css">

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

    .cnnclass{
    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;
    }

    .bbcclass{
    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*/
    }

    </style>

    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")

    </script>
    </div>

    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:
    http://www.dynamicdrive.com/dynamicindex17/rsstickerajax/index.htm

    Please help ! Im desperate!

    Qlex

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: stuck at adding a RSS ticker to template Link to this post

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

  • qlex
    Avatar
    Community Member
    68 Posts

    Re: stuck at adding a RSS ticker to template Link to this post

    Hi Willr,
    i am not using blackcandy (i have rewritten template based on paddygreen theme idea) at www.ztm.poznan.pl.

    My header has:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" >

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

    Qlex

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: stuck at adding a RSS ticker to template Link to this post

    Remove this line

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

    and it should work

  • qlex
    Avatar
    Community Member
    68 Posts

    Re: stuck at adding a RSS ticker to template Link to this post

    Hi,
    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!

    1038 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.