[Zope3-Users] Tales slot-fill'ing order
Bernd Dorn
zope-mailinglist at mopa.at
Mon Apr 3 13:33:50 EDT 2006
On 03.04.2006, at 15:32, Frank Burkhardt wrote:
> Hi,
>
> one of my objects has to add a list of keywords as <meta>-tag to
> the html-<head>.
>
> The keyword list is dynamically created during fill-slot of the
> body. The template
> looks like this:
>
> <div metal:use-macro="context/@@standard_macros/page">
>
> <div metal:fill-slot="body" tal:omit-tag="">
> <tal:block tal:content="context/text/mpgsite:show" />
> </div>
>
> <meta metal:fill-slot="keywords" name="keywords"
> tal:attributes="content context/mpgsite:getKeyWords" />
> </div>
>
> The tales namespace-adapter 'mpgsite' is responsible for maintining
> a list of keywords
> which are extracted from a string (mpgsite:show) and which are
> returned as a list
> (mpgsite:getKeyWords).
>
> Unfortunately, the fill-slot="keywords" is processed *before* fill-
> slot="body" (*) which
> means that "context/text/mpgsite:show" is processed after "context/
> mpgsite:getKeyWords"
> which eventually means that my keyword meta tag is empty.
the slots are filled in the order which they are defined in the macro
why don' you just define variables?
<div metal:use-macro="context/@@standard_macros/page"
tal:defnie="bodyContent context/text/mpgsite:show;
kwContent context/mpgsite:getKeyWords">
<div metal:fill-slot="body" tal:omit-tag="">
<tal:block tal:content="bodyContent" />
</div>
<meta metal:fill-slot="keywords" name="keywords"
tal:attributes="content kwContent" />
</div>
>
> (*) This is perfectly good from metal's point of view because
> define-slot="keywords" is
> located in the html-head and define-slot="body" is in the body.
>
> Does anyone know a solution for this problem?
>
> Regards,
>
> Frank
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
More information about the Zope3-users
mailing list