ZPT/TAL computed names?
How can I invoke a macro or a tal:replace where the macro or object name has been dynamically computed at runtime? eg: <tal block define = "name string:thing_${type}_${type}"> <tal: replace = "structure here/${name}" /> </tal:block> or <tal block define = "name string:macro_${type}_${type}"> <div: metal:use-macro = "here/macro_file/${name}" /> </tal:block> I frequently find myself wanting to do pattern operations like this for things like help texts, boilerplate, etc. -- J C Lawrence ---------(*) Satan, oscillate my metallic sonatas. claw@kanga.nu He lived as a devil, eh? http://www.kanga.nu/~claw/ Evil is a name of a foeman, as I live.
J C Lawrence wrote:
How can I invoke a macro or a tal:replace where the macro or object name has been dynamically computed at runtime?
eg:
<tal block define = "name string:thing_${type}_${type}"> <tal: replace = "structure here/${name}" /> </tal:block>
<tal:block define="name string:thing_${type}_${type}"> <tal:block replace="structure here/?name" /> </tal:block>
or
<tal block define = "name string:macro_${type}_${type}"> <div: metal:use-macro = "here/macro_file/${name}" /> </tal:block>
<tal:block define="name string:macro_${type}_${type}"> <div metal:use-macro="here/macro_file/macros/?name" /> </tal:block> Is this what you are looking for? Tonico
On Fri, Mar 05, 2004 at 12:59:58AM +0100, Tonico Strasser wrote:
J C Lawrence wrote:
How can I invoke a macro or a tal:replace where the macro or object name has been dynamically computed at runtime?
http://www.zopelabs.com/cookbook/1014285275 is one way. In metal:use-macro="foo", foo can be any valid TALES expression that returns a macro. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's DEMI-ELECTROCUTOR! (random hero from isometric.spaceninja.com)
participants (3)
-
J C Lawrence -
Paul Winkler -
Tonico Strasser