| Egg-Release documentation | view source | Contained in the Egg-Release distribution. |
Egg::Plugin::Banner::Rotate - Plugin to display advertisement rotating.
use Egg qw/ Banner::Rotate /;
my $banner= $e->banner_rotate->get_random('banner_name');
$e->stash->{head_banner}= qq{<a href="$banner->{url}"><img src="$banner->{img_url}" /></a>};
The method that can be acquired by switching the data of the advertisement registered beforehand in every case is offered.
Please make a suitable data file for advertising data beforehand by the YAML format. This advertising data is a thing composed of ARRAY without fail.
--- url: http://banner/redirect/hoo.html img_url: http://banner/images/hoo.gif --- url: http://banner/redirect/hoge.html img_url: http://banner/images/hoge.gif
The element in ARRAY is not very cared about. It only has to make data a convenient at the time of receipt format.
The configuration is set with the key 'plugin_banner_rotate'.
plugin_banner_rotate => {
..........
....
},
It is passing of the directory that sets up advertising data.
Default is "$e->config->{dir}{etc}/banners".
base_dir => '<e.dir.etc>/banners',
Extension of advertising data file.
Default is 'yaml'.
extention => 'yaml',
Egg::Base has been succeeded to.
Constructor. When 'banner_rotate' method is called, it is called internally.
Advertising data is returned from data obtained by 'banners' method at random. The argument is passed to 'banners' method.
my $banner= $br->get_random('hoge');
The element of ARRAY registered in YAML extends as it is in data.
Advertising data is sequentially returned from data obtained by 'banners' method. The argument is passed to 'banners' method.
my $banner= $br->get_turns('hoge');
The element of ARRAY registered in YAML extends as it is in data.
This method clears it though 'banners' method uses cash.
When BANNER_NAME is specified, only the corresponding cash is cleared. When BANNER_NAME is unspecification, all cash is cleared.
$br->clear_cache('booo');
Masatoshi Mizuno <lushe&64;cpan.org>
Copyright (C) 2008 Bee Flag, Corp. <http://egg.bomcity.com/>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
| Egg-Release documentation | view source | Contained in the Egg-Release distribution. |