[Templates] Relative paths

Jonas Liljegren jonas@paranormal.se
Wed, 16 Aug 2000 17:25:28 +0200 (CEST)


On Wed, 16 Aug 2000, Andy Wardley wrote:

> On Aug 16,  2:56pm, Jonas Liljegren wrote:
> >   [% PROCESS '../site/front.html' %]
> >
> > I get the response:
> >
> >   ../site/front.html: relative paths are not allowed (set RELATIVE option)
> >
> >
> > This is a contradiction. Paths relative to the INCLUDE_PATH works if they
> > are of the form path/to/template, but not if they say ../path/template.  I
> > think that '..' should be allowed.
> 
> The problem with allowing relative paths by default is that someone could
> say:
> 
>    [% INCLUDE ../../../../../../../../../etc/passwd %]

Thats true.. :-(

I put the admin templates and the site (to be static) templates in two
diffrent directories. I wanted to use the site templates for a live
preview and said [% PROCESS ../site/front.html preview=1 %]

The idea was to group the templates.

  tmpl/admin
  tmpl/site
  tmpl/test

I would put tmpl/site in the INCLUDE_PATH but there would be a name
collision. One cracy idea is to allow [% INCLUDE PARENT menu.html %] for
not using the first dir in the INCLUDE_PATH.

But I maby should give up on this. (I put a symlink in the admin dir to
the site dir.)




> > The RELATIVE option is for searching for templates relative to the current
> > directory.  Would anyone realy want to use that option?
> 
> Most often you wouldn't.  But tpage and ttree rely on it, for example.
> Remember that TT isn't just for web servers.

That doesn't exclude the usefulness to allow naming of templates relative
to the template location in the file system.  But I have no plans to use
that... ;)



> > One last thing.  Then does TT2 beta 4 come out? ;-)
> 
> It comes out when you stop adding things to the TODO list. :-)=

You could set up a CVS and a list of unasigned tasks. Maby I would submit
a patch...

But maby not.  I'm going to turn this project over to sombyde else and
start working on Wraf instead.  Just two more days... :)


-- 
/ Jonas  -  http://jonas.liljegren.org/myself/en/index.html