SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru rashidr's Avatar
    Join Date
    Jun 2004
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help me to convert news ticker to RSS News Ticker

    I have a simple news ticker script that taking scrolling text, but i want that it should take contents from rss feed.

    Here is the code
    HTML Code:
    <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="jquery.li-scroller.1.0.js"></script>
    <link rel="stylesheet" href="li-scroller.css" type="text/css" media="screen" /> 
    <script type="text/javascript">
    $(function(){
        $("ul#ticker01").liScroll();
        $("ul#ticker02").liScroll({travelocity: 0.15});
    });
    </script>
    
                    <ul id="ticker01">
                                <li><span>10/10/2007</span><a href="#/ogt/content/news/News183.complete">The first thing that most Javascript programmers</a></li>
                                <li><span>10/10/2007</span><a href="#/ogt/content/news/News175.complete">End up doing is adding some code</a></li>
                                <li><span>10/10/2007</span><a href="#/ogt/content/news/News177.complete">The code that you want to run</a></li>
                    </ul>
    
    Anyone can help me in converting simple ticker too rss ticker?

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I'm no JavaScript guy, but try this.
    Code HTML4Strict:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
        <script type="text/javascript" src="http://hamiltonchua.googlecode.com/svn-history/r1/js/jquery/jquery.li-scroller.1.0.js"></script>
        <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssreset/reset-min.css" />
        <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssbase/base-min.css" />
        <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssfonts/fonts-min.css" />
        <title>
          YQL/XML Demo
        </title>
      </head>
      <body>
        <ul id="feed"></ul>
        <script type="text/javascript" charset="utf-8">
        //<![CDATA[
          $(document).ready(function(){
            $.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Fwww.sitepoint.com%2Fforums%2Fexternal.php%3Ftype%3Dxml%26forumids%3D34'&format=json&callback=?", function(yql){
              if(undefined !== yql.query.error){
                console.log('YQL Error: ' + yql.query.error);
                return;
              }
              $(yql.query.results.source.thread).each(function(){
                $('ul#feed').append('<li>' + this.title + '</li>');
              });
            });
          });
        //]]>
        </script>
      </body>
    </html>

    It uses YQL to obtain the XML feed for this SitePoint forum in JSON.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.


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
  •