bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
Fellow Monasterians
<disclaimer>This is more about a Perl module than Perl.</disclaimer>
I'm having problems getting <base href> to work in a particular H::T scenerio. I've tried a number of things, but I feel like I'm hunting gophers.
First, here's my file layout:
In root: index.cgi [cgi-bin] -> contact.pl [pages] -> contact.tmpl -> topnav.tmpl -> thankyou.tmpl
Now, here's the salient code
INDEX.CGI: $template = HTML::Template->new(filename => 'pages/contact.tmpl'); CONTACT.TMPL: <base href="http://132.321.33.321/" /> <tmpl_include name="pages/topnav.tmpl"> <form action="../cgi-bin/contact.pl"...> TOPNAV.TMPL ... <li><a href="?p=6">LINKS</a></li> ...
'Base href' works in the initial call of contact.tmpl from index.cgi. But if contact.tmpl is evoked from cgi-bin/contact.pl, e.g.,if errors are found in validation and I'm redisplaying the form with 'associate', H::T returns an error that it can't find my "includes".
So, I dropped the <base href> and went to relative paths. It worked fine until I called thankyou.tmpl from contact.pl after the form is processed. The navigation is messed up because it's trying to do cgi-bin/contact.pl?p=6.
I tried:
$template->param(HOME => $ENV{HOME}); $template->param(PATH => $ENV{PATH});
thinking that had something to do with it. But the "includes" error occurs in the
$template = HTML::Template->new(filename => '../pages/contact.tmpl');Bottomline, is there a reason base href does not work when calling a .tmpl file from my cgi-bin/contact.pl? Or what path convention am I not getting? Thanks all!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Path problems using HTML::Template
by perrin (Chancellor) on Aug 29, 2005 at 20:13 UTC | |
by bradcathey (Prior) on Aug 29, 2005 at 21:56 UTC | |
|
Re: Path problems using HTML::Template
by InfiniteSilence (Curate) on Aug 29, 2005 at 20:31 UTC |