[Zope3-Users] Still a skinning problem

Florian Lindner mailinglists at xgm.de
Tue Feb 6 14:05:49 EST 2007


Am Dienstag, 6. Februar 2007 11:43 schrieb Mohsen Moeeni:
> Until the gurus find time to jump in with `the right` solution...
>
> On 2/5/07, Florian Lindner <mailinglists at xgm.de> wrote:
> > The line in the template.pt:
> > <a tal:attributes="href context/@@index.html/@@absolute_url">home</a>
> > works fine as long as context is an IXGM, because index.html is
> > registered for IXGM. But if a view from the IBlog is called is it also
> > rendered in the template.pt but context now is a IBlog which does not
> > have an index.html (or at leat not the one I want) and therefore fails.
>
> Your template *assumes* the context will always have
> an `index.html` view. So it can not be used for a
> context that doesn't have it. 

I know that's the problem.

> At any rate, context 
> is not the best object you can use to link to home.
> It's better to use site root for that purpose. Something
> like:
>
> <a tal:attributes="href view/siteroot/@@index.html/@@absolute_url">home</a>
>
> Where you find site root using zope3 APIs in view code and
> assign it to siteroot.

Now there is still the problem that I need a view class that implements 
siteroot for every view that uses template.pt.
Or can I use a view class for the template itself? (tried but did not work).

Any other idea or do I don't really understand you?

Thanks,

Florian


More information about the Zope3-users mailing list