Sometimes its comfortable to generate macros from dynamic data.
Is there any way to use macros from memory instead of files?

For now, it seems that this code works:

   <tal:block metal:use-macro="$dynamic/test" />

$dynamic is a data-uri, i.e. "data://text/plain;base64," . base64_encode(macro)

Together with new PHPTAL_DataSource, attached in PHPTAL_FileSourceResolver:

+        $parsed = parse_url($path);
+        if ("data" == $parsed['scheme']) {
+            return new PHPTAL_DataSource($path);
+        }

(PHPTAL_DataSource implementation isn`t interesting at all)

I dont know if there are any drawbacks — cache, optimisation, etc?

Or maybe I am missing some fundamential concepts?

Any comments?

Maciej Łebkowski, http://lebkowski.info/kontakt.php
PHPTAL mailing list

Reply via email to