Simon Wilcox <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to