Display lib for portal
Instead of having all display code in index.pl, it could be interesting to have a library that return template name and params :
#index.pl
use Lemonldap::NG::Portal::SharedConf;
use Lemonldap::NG::Portal::Display qw(display); # Extends Portal/Simple.pm
use HTML::Template;
my $portal = Lemonldap::NG::Portal::SharedConf->new();
my $skin = $portal->{portalSkin};
my $skin_dir = $ENV{DOCUMENT_ROOT} . "/skins";
my($templateName,%templateParams) = $portal->display(); # will call process()
my $template = HTML::Template->new(
filename => "skin_dir/
skin/$templateName",
die_on_bad_params => 0,
cache => 0,
global_vars => 1,
filter => sub { $portal->translate_template(@_) }
);
while ( my ( $k, $v ) = each %templateParams ) {
$template->param( $k, $v );
}
print $portal->header('text/html; charset=utf-8');
print $template->output;