I discovered this issue of relative paths some time ago, pre 2.4, and sent a
patch to the list. Sam asked for a test file and I never followed up. Here's
the original email and patch. You will probably have to apply the patch
manually)

   
My collegue and I setup a template directory structure such that include files
could be referenced using relative paths, but then I discovered that
HTML-Template did not allow that. Fortunately, the fix was quite simple.  I
hope it will be accepted and merged into the main distribution.  While the
problem could be solved using a bunch of values in the PATH array, we'd then
have to depend on the order of the values to determine which of n possible
include files would be found and used (for n > 1).  Anyway, I hope someone else
finds this useful.
   

--- Template.pm.orig    Sat Dec 23 14:59:51 2000
+++ Template.pm Wed Jun  6 17:22:45 2001
@@ -2092,7 +2092,7 @@
           my $filename = $name;
   
           # look for the included file...
-          my @path = split('/', $options->{filepath});
+          my @path = split('/', $fstack[$#fstack]->[0]);
           my $filepath;
           if ($options->{search_path_on_include}) {
             $filepath = $self->_find_file($filename);

-Gyepi


On Tue, Jan 15, 2002 at 06:24:58PM -0500, David Ferrance wrote:
> Hi guys,
> 
> I recently upgraded from an older version of H::T to 2.4.  My application has
> perl scripts in a different directory from the templates, and all of my TMPL_INCLUDE
> statements broke.  Here is what I learned:
> 
> In the <TMPL_INCLUDE> documentation, it is stated that the path to the
> enclosing file is tried first.
> 
> However, search_path_on_include docs says that only the working directory is tried.
> 
> Finally, _find_file does appear to be written using the current working
> directory instead of the path of the enclosing file.
> 
> Personally I think it makes more sense to have INCLUDE paths be
> relative to the enclosing document, but changing it would probably
> break lots of existing apps.  After all, this whole issue came
> up because while upgrading from an older version of H::T, the 
> behavior did change, and it did break my app.  So maybe you've
> already discussed this topic on the list.
> 
> Anyway, I'm just curious to get the consensus on which behavior
> is intended and possibly why.
> 
> -Dave
> 
> BTW, the comment to _find_file says "of" instead of "or".  But it 
> doesn't seem to cause any problems :)

-- 
Gyepi Sam 
Senior Developer
Palm Digital Media Group

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to