Jticker
Questions answered by this recipe
How can I show list items (Trail) or an RSS feed as a newsticker?
Description
The jticker Recipe is based on jQuery (JavaScript Library) and the jQuery Plugin "InnerFade". It creates a newsticker like presentation from a list or an RSS feed. (Demo page will be available soon.)
Installation
Download the jticker.zipΔ file and extract locally. It contains the following files
+ jticker.php + jticker |-- jquery.easing.js |-- jquery.innerfade.js |-- jticker.xslt |-- style.css
Copy the jticker.php
into your cookbook directory on your server and the jticker folder into your (farm) pub-directory. Then add the following to your localization file
include_once($FarmD.'/cookbook/jticker.php');
Configuration
Please note: The configuration options must be set before the include (see above)!
$jtickerapiurl
This is the URL to load the jQuery Core from. Default is https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js
. You may change this if you have a local jQuery installation.
$jtickerspeed
Animation speed in milliseconds. (higher values = slower). Default: 2000
$jtickertimeout
Time in milliseconds to show each item (higher values = longer). Default: 5000
$jtickereasing
Easing effect to use. Default: 'linear'
$jtickerheight
Height of the ticker container. You may have to tweak this value. Default: '1em'
To tweak the layout, patch the style.css
.
Example (put into your [farm]config.php
)
$jtickerspeed=600; $jtickertimeout=800; include_once($FarmD.'/cookbook/jticker.php');
Usage
Newsticker from unordered list
To create a newsticker from a page containing a list, use this markup:
(:pagelist trail=<TrailPage> fmt=jticker:)
Newsticker from RSS feed
To load an RSS feed an create a ticker from the contents, use:
(:jtickerRSS feed=<Feed-URL> [cachetime=<time>] [cachename=<Name>] [maxitems=<Number>] :)
The only option required is (of course) feed. Put the URL of the feed there.
As the code is based on the InlineRSS Recipe, read that recipe for the other options.
Notes
Change log / Release notes
- 2014-10-29
- Fixed for use with PHP 5.5
- 2011-03-24
- First release.
See also
Contributors
Comments
See discussion at Jticker-Talk?
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.