I'm not sure if you're familiar with viewlets, but that might be a solution for you here also.

On Feb 6, 2007, at 8:05 PM, Florian Lindner wrote:

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 <[EMAIL PROTECTED]> 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
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to