Archived
4
2

Configure root template page in config file

Currently the root template is page.tpl.html.
This commit is contained in:
Roan Horning 2022-06-29 11:03:32 -04:00
parent e19e34a60a
commit dd8b9b655b
No known key found for this signature in database
GPG Key ID: 6E07059BD168E395
2 changed files with 9 additions and 4 deletions

View File

@ -55,7 +55,7 @@ sub main {
read_config "site.cfg" => my %config; read_config "site.cfg" => my %config;
my $tt = get_template_html($config{DBI}); my $tt = get_template_html($config{DBI});
generate_page($tt, $config{correspondents}{navigation}, $config{correspondents}{content}); generate_page($tt, $config{root_template}{content}, $config{correspondents}{navigation}, $config{correspondents}{content});
return 0; return 0;
} }
@ -79,14 +79,14 @@ sub get_template_html (\%@) {
} }
sub generate_page ($tt, $navigation, $content) { sub generate_page {
my ($tt, $navigation, $content) = @_; my ($tt, $page, $navigation, $content) = @_;
my $tt_vars = { my $tt_vars = {
navigation => $navigation, navigation => $navigation,
content => $content content => $content
}; };
$tt->process('page.tpl.html', $tt_vars) $tt->process($page, $tt_vars)
|| die $tt->error(), "\n"; || die $tt->error(), "\n";
} }

View File

@ -6,6 +6,11 @@ driver: dbi:SQLite:hpr.db
user: user:
password: password:
# Configure the root template page which pulls in the navigation and
# content templates used by each page.
[root_template]
content: page.tpl.html
# Configure the navigation menu and the content templates for each page # Configure the navigation menu and the content templates for each page
# of the site: # of the site:
# [page_name] # [page_name]