Results 1 to 2 of 2

Thread: Help with RSS/Ajax ticker script

  1. #1
    Join Date
    Mar 2011
    Location
    In a house with people who try to look after me.
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with RSS/Ajax ticker script

    1) Script Title: RSS Ajax Ticker

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ajax/index.htm

    3) Describe problem: The script, as copied from DD works on my site, exactly as it does on DD.

    I want to modify it, so I can include other news feeds, besides CNN and BBC, while keeping those.

    How/Which of the files do I need to modify?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Using a text only editor like NotePad, open up bridge.php in the lastrss folder. There you will see:

    Code:
    // List of RSS URLs
    $rsslist=array(
    "CNN" => "http://rss.cnn.com/rss/cnn_topstories.rss",
    "BBC" => "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml",
    "news.com" => "http://news.com.com/2547-1_3-0-5.xml",
    "slashdot" => "http://rss.slashdot.org/Slashdot/slashdot",
    "dynamicdrive" => "http://www.dynamicdrive.com/export.php?type=new"
    );
    Using the same format, add your additional feed(s). Notice each is a quoted keyword (the RSS_id for that feed, pick any unique keyword for this) followed by => followed by the quoted URL to that feed. Each entry line has a comma after it, except the last one. It's important that yours do to, and that the last one and only the last one has no comma following it.

    Once you have that set the way you want it, save it.

    Then on your HTML page (your equivalent to demo.htm from the distribution archive), add the call(s) for the additional feed(s). Follow the format as given on the demo page:

    Code:
    <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 seconds (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: "string" to control which parts of an item to display: "date" or "date+description"
    
    new rssticker_ajax("BBC", 600, "ddbox", "bbcclass", 3500, "date+description")
    
    </script>
    For the RSS_id (BBC in the above), use the same keyword for that feed as you just set it in bridge.php. Set the cache time as desired. Choose a unique divId for the id of div element that will be created by the script for this feed, use any class you like, set the delay as desired and your preference for date or date+description for that feed. Place this call on your page in the body where you want the feed to appear. If desired, style the feed in your stylesheet using the divId and/or divClass you set in the call.
    Last edited by jscheuer1; 03-26-2011 at 05:01 PM. Reason: add detail
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •