Gossamer Forum
Quote Reply
default template
i will have about 10-12 tables in my database. to simplify my template creation, i want to have a default set of templates to apply to all the tables. however, i want to create custom templates for certain pages so that each database will have its own home page for instance. so i don't have to change 10 templates every time i want to change my header or footer, i would like to put those and other common templates in a default template folder and then put only the customized pages in the folder for each table. for some tables, the home.html template might be the only one in the folder. so i want dbman sql to look in the custom folder first, but if it doesn't find the template it needs, look in the default folder. i created a template folder for gallery and put home.html in it. when i click List All, i get the following error:

GT::Template::Parser (23898): Unable to locate template file 'search_results.html' in '.../www.mysite/admin/templates/gallery' or any inheritance directories at GT::Template::_compile_template line 626.
i see there is a default_tpl tag/variable in setup. how/where do i tell dbman to look in my default template directory? thanks.
Quote Reply
Re: [delicia] default template In reply to
figured it out. in home.pm:

my ($dir_tmp) ;
if ( -e "$self->{glb_cfg}->{admin_root_path}/templates/$self->{cfg}->{template}/$template" ) {
$dir_tmp = $self->{cfg}->{'template'};
}
else {
$dir_tmp = $self->{cgi}->{t} || $self->{glb_cfg}->{default_tpl};
}
###
# my $dir_tmp = $self->{cgi}->{t} || $self->{cfg}->{'template'} || $self->{glb_cfg}->{default_tpl};
(-x $self->{root} . "/templates/$dir_tmp") or return print $self->{in}->header, $self->_language('INVALID_TEMPLATE',

$dir_tmp);
GT::Template->parse($template, $args, { print => 1, root => $self->{root} . "/templates/$dir_tmp" });
Quote Reply
Re: [delicia] default template In reply to
Hello

You say in your post that you have 10-12 tables in your database,and you wanted custom templates for each database. Did you mean for each table? I have three databases with lots of data and can't work out how to set up the other two and wondered how you did this. Is it possible for you to post the URL to your site so I can see how your database works?


Denise
Quote Reply
Re: [Denise_] default template In reply to
yes, i meant table. in the table setup you specify which template directory to use for that table. so what i've done is create a complete set of templates in my selected default template directory. then, for a table that i want a different result, i've specified a different template directory just for that table. in that custom template directory, i put the customized template(s) i want. so the code i posted above looks first in the custom template directory. then if not found there, it gets the one from the default template directory.

there are unfortunately a few templates that are apparently required in each template directory (header, footer, can't remember the others offhand).

hope this makes sense. i can't post a link at this time.