[Zope] Using a template for all pages, or calling dtml as a function, or perhaps switch to Zpt ??

a.p.bourne@salford.ac.uk A.P.Bourne@salford.ac.uk
Wed, 12 Jun 2002 17:57:45 +0100


Max,

Is your index_html object a DTML Method or a DTML Document?

If it's a DTML Document then acquisition won't work in the way you 
expected.  

Change it into a DTML Method and the structure you describe below 
will work.

You will not need to create an index_html object in every sub-folder 
(but each subfolder can optionally have its own unique 
primary_content and secondary_content objects).

Regards,

Andy Bourne



> Date: Wed, 12 Jun 2002 09:52:03 +0200
> From: Max M <maxm@mxm.dk>
> To: zope@zope.org
> Subject: [Zope] Using a template for all pages, or calling dtml as a
> function, or
>  perhaps switch to Zpt ??
> 
> I have a site where i want to use the same template for all the pages.
> Lets say that I have the following structure:
> 
> index_html:
>     <b>
>     <dtml-var primary_content>
>     </b>
>     <i>
>     <dtml-var secondary_content>
>     </i>
> 
> I then want to use this template for all my pages. Most of my products
> will them implement "primary_content()" and "secondary_content()"
> methods. If a product hasn't implemented one of the methods, it just
> finds it from somewhere up the aquisition (aq) path
> 
> So far so good.
> 
> My problem is that it seems that I have to define "index_html" in
> every product for this to work.
> 
> If I just put an "index_html" in the root of my aq path zope will
> traverse it's way up to it allright, but naturally won't find the
> objects "primary_content()" and "secondary_content()" methods. So the
> view is wrong.
> 
> If I create a simple dtml attribute that looks like:
> 
> index_html:
>     <dtml-var "aq_parent.index_html(None, _)"> to call the aquired
> index_html within the current namespace, it doesn't work either.
> 
> I want to use this type of layout in a site using a lot of products,
> so putting all the index_html code inside each product is A Bad Thing
> for many reasons.
> 
> Has anybody got an idea as to how I can approach this? Perhaps by
> using Zpt ?
> 
> Isn't it possible to call the index_html like a function from within
> the current namespace ?? If so, isn't index_html(None, _) the right
> way to do it?
> 
> 
> regards Max M
> 
> -- 
> 
> "Sorry I would Really Like To Help More On This Project,
> But Am To Busy Doing Paid Work On A Tight Deadline"
>     Max M


Andy Bourne
Information Officer
Information Services Division
University of Salford
Tel: 0161-295-6229
Fax: 0161-295-6189