Hi,
I'm looking for a plugin to display a random quote from a pool (either on a text file or in the database). I tried "PWG Stuffs" as it has an option called "Random Quote" but it doesn't seem to be capable of rotating quotes (at least, I've not found any separator).
Is there a similar plugin available?
Offline
What does "rotating quotes" means ?
I think you can totally use the PWG Stuff block by creating a custom PHP script which give this kind output
http://citations.hasarddujour.com/citat … u-jour.php (Ctrl+U for real output)
Offline
Rotating means display a different quote every time I reload the page.
I'll give a try to your suggested solution.
Last edited by urzahil (2013-09-10 12:13:42)
Offline
In the personal plugin
define('CIT_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
add_event_handler('loc_begin_index', 'citations');
function citations()
{
global $conf, $page, $template, $tab, $cit, $nbr ;
if (isset($page['section']) and $page['section'] == 'categories' and !isset($page['category']))
{
$template->set_filename('citations', realpath(CIT_PATH.'citation.tpl'));
$tab = file(CIT_PATH.'citations.txt') ;
srand((double)microtime() * 1000000) ;
$nbr = rand(0, (count($tab) - 1)) ;
$cit=$tab[$nbr];
$template->assign(array('CITATIONS' => $cit));
$template->assign_var_from_handle('PLUGIN_INDEX_CONTENT_BEFORE', 'citations');
}
}
by FTP
add in directory personalplugin
a file citation.tpl with
citation.tpl wrote:
<div class="content">
<h2>Citations</h2>
{$CITATIONS}
</div>
and file citations.txt with by line examble
citations.txt wrote:
Alphonse Allais : Impossible de vous dire mon âge, il change tout le temps.
Christophe Colomb : On ne va jamais aussi loin que lorsqu'on ne sait pas où l'on va
Georges Courteline, Ecrivain français : Pour savoir qu'un verre était de trop, encore faut-il l'avoir bu.
Cicéron : On voit qu'un ami est sûr quand notre situation ne l'est pas.
Voltaire : Courtes lettres et longues amitiés, tel est ma devise.
Offline