Referring to internal Metal Macros (in the same ZPT)?
Hi, Is there an easier way to refer to a macro defined in same ZPT that calls the macro: <html xmlns:tal="..." xmlns:metal="..."><body> <div metal:define-macro="test">Test</div> <div metal:define-macro="default"> <div metal:use-macro="here/<this_zpt's_id>/macros/test"/> </div> </body></html> What I would whan it: <div metal:define-macro="default"> <div metal:use-macro="macros/test"/> </div> where macros would be the local macros. In this way I can rename the ZPT without breaking the functionality of the template. Best Regards, Johan Carlsson -- Easy Publisher Developers Team Johan Carlsson johanc@easypublisher.com Mail: Birkagatan 9 SE-113 36 Stockholm Sweden Phone +46-(0)8-32 31 23 Fax +46-(0)8-32 31 83 Mobil +46-(0)70-558 25 24 http://www.easypublisher.com
Hi again, Is there anyway to query a ZPT about its macros. I want to implement one macro per meta_type, but I'm not going to implement all meta_types so I would like to query the template if the macro is available. I guess I could use a try-statement to trap any non existing macros, but I would rather query it more explicitly. Best Regards, Johan CArlsson
Something like template.macros.keys() should do what you want. Stefan --On Montag, 31. März 2003 10:48 +0000 "Johan Carlsson [EasyPublisher]" <johanc@easypublisher.com> wrote:
Is there anyway to query a ZPT about its macros.
-- Those who write software only for pay should go hurt some other field. /Erik Naggum/
At 13:21 2003-03-31 +0200, Stefan H. Holek said:
Something like template.macros.keys() should do what you want. Stefan
Thanks Stefan, I found out that macros is a regular mapping object. So the TALES: python:<path>.macros.has_key(file.meta_type) will do the trick :-) Johan -- Easy Publisher Developers Team Johan Carlsson johanc@easypublisher.com Mail: Birkagatan 9 SE-113 36 Stockholm Sweden Phone +46-(0)8-32 31 23 Fax +46-(0)8-32 31 83 Mobil +46-(0)70-558 25 24 http://www.easypublisher.com
have you tried <div metal:use-macro="template/macros/test" /> ? jens On Monday, Mar 31, 2003, at 05:20 US/Eastern, Johan Carlsson [EasyPublisher] wrote:
Hi, Is there an easier way to refer to a macro defined in same ZPT that calls the macro:
<html xmlns:tal="..." xmlns:metal="..."><body>
<div metal:define-macro="test">Test</div>
<div metal:define-macro="default"> <div metal:use-macro="here/<this_zpt's_id>/macros/test"/> </div>
</body></html>
What I would whan it:
<div metal:define-macro="default"> <div metal:use-macro="macros/test"/> </div>
where macros would be the local macros. In this way I can rename the ZPT without breaking the functionality of the template.
Best Regards, Johan Carlsson
At 07:42 2003-03-31 -0500, Jens Vagelpohl wrote:
have you tried <div metal:use-macro="template/macros/test" /> ?
Yes, I have. template seams to always refer to the initial template, not to the current template (containing the macro). Regards, Johan Carlsson -- Easy Publisher Developers Team Johan Carlsson johanc@easypublisher.com Mail: Birkagatan 9 SE-113 36 Stockholm Sweden Phone +46-(0)8-32 31 23 Fax +46-(0)8-32 31 83 Mobil +46-(0)70-558 25 24 http://www.easypublisher.com
participants (3)
-
Jens Vagelpohl -
Johan Carlsson [EasyPublisher] -
Stefan H. Holek