[PHPTAL] HTTP paths for templates

Sean Hodges shodges at wav2.com
Thu Jan 10 16:07:46 CET 2008


Thanks Kornel, I'll try the setSource() approach you mentioned.

The reason I want to load templates via HTTP is that the templates I am 
loading may not be on the same server as PHPTAL. It will also simplify 
redeployment doing it this way.

I will bear in mind that I may have trouble with macros doing it this 
way, however I don't think this will be a problem for me at this point.

Regards,

Sean


Kornel Lesinski wrote:
> 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
>
> _______________________________________________
> PHPTAL mailing list
> PHPTAL at lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal




More information about the PHPTAL mailing list