Home
Dynamic Content
Iframe and Ajax
Here
|
Categories
Other Sections
Sweet Ads
Compatibility
|
|
FF1+ IE5+ Opr8+
Advanced RSS Ticker (Ajax invocation) Author:
Description: RSS is a popular format for syndicating and displaying external content on your site, such as the latest headlines from CNN. Well, with this powerful RSS ticker script, you can now easily display any RSS content on your site in a ticker fashion! This script uses a simple PHP based RSS parser called LastRSS for retrieving a RSS feed, then Ajax and DHTML to display the feed dynamically and with flare. As a pre-requisite then, your site itself must support PHP, though the page using this ticker can be any regular HTML file. Requirement of this script: Ability to run PHP on your site. Note that page(s) displaying the ticker and the backend PHP script must be on the same domain due to Ajax limitations. Here are some features of Advanced RSS Ticker (Ajax invocation):
A demo trumps any explanation, so here it is: Demos: Each ticker is called independently on the page, using the core function: <script type="text/javascript">
//rssticker_ajax(RSS_id, cachetime, divId, divClass, delay, optionalswitch)
new rssticker_ajax("BBC", 1200, "ddbox", "bbcclass", 3500, "date+description")
</script>
Detailed info below. Directions: The easiest way to install Advanced Ajax ticker is to download the zip file below: -rsstickerajax.zipwhich contains all the files that make up the script. They are:
1) For demo.htm: Open up "demo.htm", and copy the code found inside into the page(s) you wish the ticker to be displayed in. Make sure the code: <script src="rssticker.js" type="text/javascript"> inside the HEAD section correctly references the location of "rssticker.js" on your server, if it's been moved to a different directory. The code inside the BODY section shows how to invoke an RSS ticker instance: <script type="text/javascript"> 2) For rssticker.js: Open up "rssticker.js", and at the top, simply make sure the path to "bridge.php" on your server is correct: //Relative URL: var lastrssbridgeurl="lastrss/bridge.php" //Absolute URL (uncomment below) //var lastrssbridgeurl="http://"+window.location.hostname+"/lastrss/bridge.php" If you wish to use an absolute reference to "bridge.php", simply uncomment the last line and configure that instead. The root domain is dynamically constructed due to Ajax being finicky about the syntax. See Load Absolute URL explanation. 3) For bridge.php: Bridge.php is a custom PHP script that communicates between our ticker script and lastRSS.php using Ajax. Open up this file using any text editor, and edit the variables as instructed by the comments. It is recommended you read up on the documentation for lastRSS to get a full understanding of what each variable means and how you can take advantage of all of the available features. 4) For lastRSS.php: No editing required. Upload as is. And there you have it! More information on Advanced RSS Ticker (Ajax invocation)Once you've successfully installed the script, most day to day changes to the ticker is done easily and on the front end, via the main RSS ticker function: <script type="text/javascript">
//rssticker_ajax(RSS_id, cachetime, divId, divClass, delay, optionalswitch)
new rssticker_ajax("BBC", 1200, "ddbox", "bbcclass", 3500, "date+description")
</script>
A few notes on the parameters above:
* Regarding the cache time, a tip is to set it to 0 while you're testing out the ticker, to make sure any changes are instantly visible, then change it back to the desired number afterwards. This is extremely helpful, for example, if you've made changes to "bridge.php" to change the format of the date output- that change will only show up instantly if you've set cache to 0. ** If you want a fading effect to occur between message change for the ticker, just add the code: filter:progid:DXImageTransform.Microsoft.alpha(opacity=80); -moz-opacity: 0.8; inside your CSS class for that ticker instance. It's that easy! The fade effect uses up about 1/2 second, so you'll want to increase the "delay" parameter accordingly if enabled.
|