problems with paths

Brad Cathey <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <BF2F9841.99E2%[email protected]>
I'm having problems getting <base href> to work in a particular scenerio.
First, here's my file layout:

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
<tmpl_include name="../pages/topnav.tmpl">
...
<li><a href="?p=6">LINKS</a></li>
...


'Base href' works in the initial call of contact.tmpl from index.cgi in the
root. But if contact.tmpl is called from cgi-bin/contact.pl, e.g.,if errors
are found in validation and I'm returning the screen 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 call 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});

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 .tmpls
from my cgi-bin/contact.pl?

Thanks, Brad




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.