> Greets Folks,
>
> Does anyone here place their .tmpl files in a special
> directory assigned just for templates, like maybe:
>
> /cgi-bin/templates
>
> I was thinking of doing this for organizational
> purposes, but I wasn't sure of what problems I might
> run into, or what path I would have to use in the CGI
> programs, etc...
>
> Any advice appreciated.
>
> Thanks,
>
> Will

We usually separate the template names and location to a configuration file,
which the designers can update on their own. It look something like this:

TemplateConfig.pm
==================
package TemplateConfig;
use vars '$AUTOLOAD';

sub new {
    my $class = shift;
    bless {

          _base_template_path        => '/path/to/files/templates',
            _add_rec                 => 'emp_add.html',
            _delete_rec              => 'emp_delete.html',
            _edit_rec                => 'emp_edit.html'


    }, $class;

}

sub AUTOLOAD
{
        my ($self) = @_;
        $AUTOLOAD =~ /.*::get(_\w+)/;
        exists $self->{$1};
        return $self->{$1};
}

1;

In the cgi script, the package is instantiated and the file names are used
in the following format:

use TemplateConfig;
$config = TemplateConfig->new();

$filename = $config->get_base_template_path . $config->get_add_rec



Roy
[EMAIL PROTECTED]



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
No, I will not fix your computer.
http://thinkgeek.com/sf
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to