Everything about Metals totally explained
The
Macro
Expansion
Template
Attribute
Language complements
TAL, providing
macros which allow the reuse of code across template files. Both were created for
Zope but are used in other
Python projects as well.
Overview
METAL complements
TAL with the ability to reuse code. It allows the developer to define and use macros, which in turn may have
slots; when using a macro, variational content can be specified for a slot.
When generating
XML documents, the XML namespace must be specified
(
xmlns:metal="http://xml.zope.org/namespaces/metal").
Attributes
The following attributes are recognised, normally requiring a „
metal:“ prefix:
define-macro » creates a macro
; define-slot » creates a slot inside a macro
use-macro » uses a macro (normally given via a TALES path expression)
; fill-slot » when using a macro, replaces the default content of the given slot
extend-macro » since Zope v3: extends a macro, comparable to subclassing, by redefining of slots
Normally, just one of those is used at a time.
In cases when no tag is present which lends itself to take the attributes, and in special cases when more than one METAL attribute is needed, special METAL tags can be used, making the „metal:“ prefix optional. E. g. (sketched with Roundup in mind):
<html metal:define-macro="icing">
...
<metal:myslot define-slot="optional-form"/>
...
</html>
<html metal:use-macro="templates/page/macros/icing">
<form metal:fill-slot="optional-form" action="."
tal:attributes="action context/designator">
...
</form>
</html>
Usage
TAL/
TALES/METAL are used by the following projects:
Further Information
Get more info on 'Metals'.
|
External Link Exchanges
Do you know how hard it is to get a link from a large encyclopaedia? Well we're different and will prove it. To get a link from us just add the following HTML to your site on a relevant page:
<a href="http://metal.totallyexplained.com">METAL Totally Explained</a>
Then simply click through this link from your web page. Our crawlers will verify your link, extract the title of your web page and instantly add a link back to it. If you like you can remove the words Totally Explained and embed the link in article text.
As long as your link remains in place, we'll keep our link to you right here. Please play fair - our crawlers are watching. Your site must be closely related to this one's topic. Any kind of spamming, dubious practises or removing the link will result in your link from us being dropped and, potentially, your whole site being banned. |