Re: [Templates] Apache::Template & plugin path problems

[prev] [thread] [next] [Date index for 2004/05/13]

From: Harald Joerg
Subject: Re: [Templates] Apache::Template & plugin path problems
Date: 09:55 on 13 May 2004
Simon Wilcox <essuu@xxxxxxxx.xxx> writes:

> My file structure looks like this:
>
> /var/www/site/html (html docs)
> /var/www/site/lib  (TT templates)
> /var/www/site/data (xml files)
>
> In my template I have
>
> [% USE XML::Simple( 'data/menu.xml' ) %]
>
> This works fine in ttree when run from /var/www/site but blows up when 
> using Apache::Template (which we often do for rapid development, and burn 
> using ttree for publication).
>
> I've set an include path using TT2IncludePath so that it should look 
> relative to /var/www/site but I get an error:
>
> [Wed May 12 17:56:54 2004] [error] access to 
> /var/www/site/html/index.html failed for 192.168.112.82, reason: 
> plugin error - File does not exist: data/menu.xml at 
> /usr/local/lib/perl5/site_perl/5.8.2/i686-linux/Template/Plugin/XML/Simple.pm 
> line 47
>
> Any ideas what I'm doing wrong here ?

As Dave mentioned, the XML plugin(s) suffer from not being TT aware
(I fell over the same feature with Simon Cozen's XSLT plugin).

However, I think there's a rather simple workaround.
XML::Simple groks XML strings as well as file names.
An approach using TT paths would look like:

[% xmlstring = BLOCK; INSERT data/menu.xml; END %]
[% USE XML::Simple( xmlstring ) %]
        -- 
        HTH,
haj


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] Apache::Template & plugin path problems
darren chamberlain 17:08 on 12 May 2004

Re: [Templates] Apache::Template & plugin path problems
Harald Joerg 09:55 on 13 May 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52