Oscar Serrano <[EMAIL PROTECTED]> on Feb 12, 2002:

> Is it possible to INSERT or INCLUDE a remote template?
>
> Something like this?
>
> <BODY>
> [% INSERT "http://otherdomain.com/templates/remotetemplate.tt2"; %]
> </BODY>

It's not possible out of the box. But you could probably do something
along the lines of:

[% BLOCK httpquery %]
[% # 'ua' is a reference to an LWP::UserAgent
   response = ua.simple_request('GET', $url);
   response.content;
%]
[% END %]

[% INSERT httpquery("http://otherdomain.com/pelements/head.html";) %]
[% PROCESS httpquery("http://otherodmain.com/templates/foo.tt2";)  %]


I do think though, that it shouldn't be too hard to patch TT2 to do the
LWP Stuff by itself when a file looks like a URI. For security reasons
this functionality would have to be enabled explicitly in the Template
Processor.

PHP does exactly this and it is something I like a lot in PHP. What do
other people on the list think?

Hans




Reply via email to