[ZPT] metal:fill-slot questions

Michael Rowley os2mac at earthlink.net
Mon Mar 28 09:10:49 EST 2005


Hello!

Just a simple question, to see if I have this correct, of if I am doing 
something wrong. :)

I am trying to set the title differently based on what page I am on, 
and having some problems...

I made a modified copy of header.pt from CMFPlone, and made the title a 
metal:define-slot="title-slot", then I can fill this slot from my Main 
template which calls the html macro with

<head metal:use-macro="here/torch_header/macros/html_header">

The problem is, when I try to fill that slot from my page template that 
calls the main template, the slot does not fill... what I have had to 
do is put:

torch_main_template.pt:
<head metal:use-macro="here/torch_header/macros/html_header">
     <title metal:fill-slot="title-slot">
        <span metal:define-slot="title-slot"
              tal:omit-tag="">Once Trusted Open Source Records for Care 
and Health with Medical Data
        </span>
     </title>
</head>

then

torch.pt  which uses the master macro from torch_main_template
     <title metal:fill-slot="title-slot">Trusted Open Source Records for 
Care and Health with Medical Data</title>


and finally from torch_header.pt:

     <title metal:define-slot="title-slot"
            tal:define="portal_title portal_properties/title;
                        page_title python:here.getPageTitle(here, 
template, portal_title)" >
         <span tal:replace="page_title" />
         &mdash;
         <span tal:replace="portal_title" />
     </title>


Is this not supposed to work from nested macros/slots ?  or am I 
missing something silly.    Without the <span> in 
torch_main_template.pt, the title doesn't get overridden by torch.pt...

Michael.



More information about the ZPT mailing list