On 7 Sep 2009, at 18:16, Tobias Herp wrote:

I had (and still have) some problems when trying to use a layout macro; when I added the metal:define-macro part to the root html element, no output was generated any more (no error message).

Do you have metal:use-macro that triggers it? Do you catch and display exceptions thrown by PHPTAL? (or have display errors enabled in PHP?)

Show me the code.

Are there some "best practices" for the usage of macros?

When defining macro use tal:comment to specify what variables macro expects (e.g. tal:comment="displays data from 'user', set 'fancy' for extra formatting").

When calling macro use tal:define to pass arguments for it (e.g. <div metal:use-macro="show-user" tal:define="user foo/bar/current_user">).

I had a look at http://phptal.org/manual/en/#metal-use-macro, of course, but I couldn't find any hints regarding my no-output problem nor about how to configure where to look for templates (which would be the problem to be tackled next, once the creation of macros works).


Macros without filename are looked up in the same file. Files for external macros are looked up in the same way all templates are. Use setTemplateRepository().
http://phptal.org/manual/en/split/config-methods.html

--
regards, Kornel


_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to