# -*-perl-*-
# Keitairc::View
-# $Id: View.pm,v 1.1 2008-01-08 05:52:14 morimoto Exp $
+# $Id: View.pm,v 1.2 2008-01-09 18:49:17 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/Keitairc/View.pm,v $
#
# Copyright (c) 2008 Jun Morimoto <morimoto@mrmt.net>
my $me = shift;
my $path = shift;
- $path =~ s|^/+||;
$path = sprintf('http://%s:%d%s%s',
$me->{Config}->web_host(),
$me->{Config}->web_port(),
- $me->{Config}->web_root(),
$path);
::log_debug("path [$path]");
my $response = HTTP::Response->new(302);
}
################################################################
+sub template_path{
+ my $me = shift;
+ my $template = shift;
+ for my $template_dir (split(':', $me->{Config}->template_dir())){
+ if(-r "$template_dir/$template"){
+ return "$template_dir/$template";
+ }
+ }
+}
+
+################################################################
sub render{
my $me = shift;
my $template = shift;
my $vars = shift;
-
my $t = new HTML::Template(
- filename => $me->{Config}->template_dir() . '/' . $template,
+ filename => $me->template_path($template),
die_on_bad_params => 0,
cache => 1);
- $t->param(web_root => $me->{Config}->web_root());
$t->param(title => $me->{Config}->web_title());
$t->param(version => $me->{Config}->version());
$t->param(viewport => $me->{ClientInfo}->is_ipod());