[Zope] Re: what's the difference between metal:block and tal:block?
Gerry Kirk
gerry@dioceseonline.com
Thu, 19 Jun 2003 09:09:00 -0400
J Cameron Cooper wrote:
>>
>
> One uses these when there's no obvious or necessary tag in which to put
> a METAL or TAL declaration. It's quicker to write than a div/span plus a
> tal:omit-tag.
>
> Note that the name of the tag after the namespace (block) can really be
> anything. But 'block' seems to be our de facto standard.
>
> --jcc
JCC,
I guess I understand the syntax part of the question, but what I don't
understand is why in some cases a METAL declaration is needed. Let me
give you an example, a code snippet from a stock Plone site. This code
is inside a <metal:block define-macro>:
<tal:block tal:condition="no_types">
<select id="filter_selection"
name="filter_by_portal_type:list"
style="float: left"
onChange="submitFilterAction()"
tabindex=""
tal:attributes="tabindex tabindex/next|nothing;">
<option value="#"
tal:attributes="selected
python:test((len(filterTypes)>1 or
len(filterTypes)==0), 'selected', '');"
i18n:translate="label_show_all_items">
Show All Items
</option>
<metal:block tal:repeat="type types">
<option value="#"
tal:define="typetitle type/Title; typeid type/getId"
i18n:translate="label_show_x_only"
tal:attributes="value typeid;
selected python:test(
len(filterTypes)==1 and (typeid in filterTypes), 'selected', '');"
><span i18n:name="type"><span i18n:translate=""
tal:content="string:${typetitle}" tal:omit-tag="" /></span>s only</option>
</metal:block>
</select>
<input type="hidden" name="filter_by_Subject:tokens" value="" />
<!--you can filter by subject keywords by filling in this value-->
</tal:block>
TIA,
Gerry