====== xfortune Plugin ====== ---- plugin ---- description: Display a random quote and update it every few seconds with a new one author : Andreas Gohr email : andi@splitbrain.org type : syntax lastupdate : 2017-04-20 compatible : Lemming, Anteater depends : conflicts : similar : fortune tags : quotes, ajax, random downloadurl: https://github.com/splitbrain/dokuwiki-plugin-xfortune/zipball/master sourcerepo : https://github.com/splitbrain/dokuwiki-plugin-xfortune bugtracker : https://github.com/splitbrain/dokuwiki-plugin-xfortune/issues donationurl: http://donate.dokuwiki.org/xfortune ---- This plugin is able to read datafiles used by the popular Unix tool [[man>fortune]] and to display a random one. It then replaces the displayed one every few seconds with a new one using an AJAX request. ===== Download ===== Download and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. ==== Changes ==== {{rss>https://github.com/splitbrain/dokuwiki-plugin-xfortune/commits/master.atom date}} ===== Usage ===== Just reference a textfile with the correct format with the following syntax: {{xfortune>namespace:cookiefile.txt}} You may specify the interval for changing the cookie in seconds: {{xfortune>namespace:cookiefile.txt?15}} The default is 30 seconds. ===== Input files ===== The cookie file needs to be a text file ((the uncompiled source files for fortune, not the binary ones created by [[man>strfile]])) where each cookie is separated by a % char on it's own line. You need to upload those files through the [[:fullscreen_mediamanager|mediamanager]]. Here is an example: % My first cookie % Another cookie with multiple lines % Third cookie % ===== Known Shortcomings ===== * If your input files are not in UTF-8 this plugin will assume they are in latin1 and tries to convert them to UTF-8. If you get any charset problems, make sure the file is valid UTF-8. * Using compiled fortune cookies would probably be more effective * It is implied above, but I think it is better to state it explicitly: at least for DW //Lemming// and the latest version of the plugin, the fortune file **must** have UNIX line endings (''LF''). Windows line endings won't do. --- [[user>ryan.chappelle]] //2011/02/07 02:48//