[PHPTAL] HTTP paths for templates

Kornel Lesinski kornel at aardvarkmedia.co.uk
Tue Jan 8 15:46:02 CET 2008


On Tue, 08 Jan 2008 13:22:05 -0000, Sean Hodges <shodges at wav2.com> wrote:

> I'm trying to parse templates from an HTTP path, are there any plans to  
> include http:// path support to the template parser in PHPTAL?

I'm not sure if that's desirable. PHPTAL templates can contain PHP code,  
so it's very dangerous to execute templates from arbitrary remote servers.

Why do you want to load templates via HTTP?


If you don't use macros that would need to access other files, you can  
execute remote file using:

$tal = new PHPTAL();
$tal->setSource(file_get_contents('http://...'));

> PHPTAL_FileSourceResolver->resolve() would be called but nothing in the  
> function is executed (even outside the foreach loop!).

I haven't checked, but my guess is that realpath() used in  
PHPTAL_FileSource doesn't like URL wrappers.

-- 
regards, Kornel



More information about the PHPTAL mailing list