[ZPT] Varying templates based on location

Chris Withers chrisw@nipltd.com
Fri, 16 Aug 2002 13:47:19 +0100


Jean Jordaan wrote:
> Hi,
> 
> Still with the newbie questions .. Here's a sketch of my site:
> 
> /root/
>   global-macro-lib (define-macro="navigation")
>   template   (define-macro="page"
>               use-macro="here/global-macro-lib/macros/navigation .. etc")
>   index_html (use-macro="here/template/macros/page")
> 
> /root/subfolder/
>     subfolder-macro-lib (define-macro="navigation")
>     index_html (use-macro="here/template/macros/page")
> 
> I'm looking for a good way to have the more specific "navigation"
> macro kick in when I'm viewing subfolder. With DTML I simply had
> <dtml-var navigation> in 'standard_html_header'.

Try this layout instead:

/root/
    template   (define-macro="page"
                define-slot="navigation" <put your default navigation in here>)
    index_html (use-macro="here/template/macros/page")

/root/subfolder/
      template (define-macro="page"
                use-macro="root/template/macros/page"
                fill-slot="navigation" ,with your custom nav>)
      index_html (use-macro="here/template/macros/page")

cheers,

Chris