diff --git a/site-generator b/site-generator index 7a313d6..f59052e 100755 --- a/site-generator +++ b/site-generator @@ -54,14 +54,13 @@ sub main { # Load config file read_config "site.cfg" => my %config; - my $tt = get_template_html(); + my $tt = get_template_html($config{DBI}); generate_page($tt, $config{correspondents}{navigation}, $config{correspondents}{content}); return 0; } -sub get_template_html { - +sub get_template_html (\%@) { # For an HTML based Template file, define the # template start and end tags to also function as # HTML comments to make the template file valid HTML. @@ -71,6 +70,11 @@ sub get_template_html { EVAL_PERL => 1, START_TAG => '', + CONSTANTS => { + driver => $_[0]{driver}, + user => $_[0]{user}, + password => $_[0]{password}, + } }) || die $Template::ERROR, "\n"; } diff --git a/site.cfg b/site.cfg index c984ad4..e023acc 100644 --- a/site.cfg +++ b/site.cfg @@ -1,3 +1,11 @@ +# Configure the Perl DBI driver to allow the templates communicate +# with the database. +# dbi:: +[DBI] +driver: dbi:SQLite:hpr.db +user: +password: + # Configure the navigation menu and the content templates for each page # of the site: # [page_name]