[ZPT] Varying templates based on location / 'here' vs 'template'

Jean Jordaan jean@upfrontsystems.co.za
Mon, 19 Aug 2002 15:12:38 +0200


Michael Long wrote:
>       <div id="banner">
>         <div metal:fill-slot="banner">
>           <div tal:content="structure here/banner.pt">banner here</div>
>         </div>
>       </div>

Hmm, one detail: if you do this, then 'banner.pt' is evaluated in the
context of where it's found, which can be good, or bothersome, depending
on what you want ..

To remove clutter from my template, I moved the contents of the
<head> tag into a seperate template called 'head.pt'. Baaad idea.

/root (title: "")
  **template.pt
   <head tal:content="structure here/head.pt"></head>
  **head.pt (title: "Head")
   <title tal:content="here/title" />

/root/subfolder (title: "Subfolder")
  **index_html (title: "A Document")

- Rendering 'index_html' in 'head.pt' gets '<title><title>' :(

- Using 'template/title' in 'head.pt' gets '<title>Head<title>' :(

- When I put 'head.pt' back into 'template.pt', I got
   '<title>Subfolder</title>' :/

- Using 'template/title' gets the desired
   '<title>A Document</title>' :)

-- 
Jean Jordaan
Upfront Systems                         http://www.upfrontsystems.co.za