[Zope] zpt, metal and missing content objects (bit long)
Tim Hicks
tim@sitefusion.co.uk
Thu, 12 Sep 2002 15:23:08 +0100
> > ... what if I want to make some global changes to my site? What if I
> > want to add a heading (on every page) right after my <body> tag, and I
> > want it to be the title of the zpt (not 'standard_template', but that
> > using it). Doing the following doesn't seem to work when put in
> > 'standard_template' as 'here' is not what I want when being accessed
> > within a macro.
> >
> ><body>
> ><h1 tal:content="here/title">title inserted here</h1>
> >
>
> You could use tal:content="template/title" if you want to get the title of
> the template. here/title will give you the title of the folder containing
> the template.
Duncan,
thanks *very* much. I thought things must be a little simpler than they
seemed. This works nicely.
So, with that little issue overcome, I guess the only thing I'm left
wondering is why my content objects need to contain any explicit use of zpt
*within their source* (as opposed to as a property on the object). Using
only standard zope objects, the only ways I can see of overcoming this
require nasty url mangling that locks me into a specific site system (due to
embedded links). By this I mean, if I want to have a zpt called as a method
of my object when it's rendered, I could do one of:
/render?id=content_object
/content_object/view
where 'render' is some sort of script that does something like
standard_template.__of__(content_object) and where view is an alias to
'standard_template'.
How do other people deal with this, or do you just live with having zpt in
your content source?
cheers,
tim