[Zope3-Users] Rendering subobjects in pages

Hermann Himmelbauer dusty at qwer.tk
Mon Aug 6 09:20:19 EDT 2007


Am Montag, 6. August 2007 14:21 schrieb Greg Baker:
> How can I specify a template to render a sub-object within one of my
> content objects?
>
> For example, pretend I have a Contact object which contains a Person
> object. I am rendering the Contact object through a page template.
>
> class Contact:
>     person = Person()
>
> In all the examples I see, rendering the person would be done using many
> tal expressions like <span tal:content="context/person/name" /> or
> something similar.
>
> Is it possible to render the person object using a single tal expression,
> <div tal:content="context/person" />, having the rendering handled by a
> template somewhere?  The reason I want to do this is because the person
> object will be used in many different classes and for a consistent look and
> feel I would like to render the object the same on all pages without having
> to maintain 10 different page templates.

I'd recommend to have a look at z3c.form and z3c.formdemo, especially 
subforms. z3c.formdemo features the "addressbook" - demo, which handles such 
issues.

Regards,
Hermann

-- 
x1 at aon.at
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7


More information about the Zope3-users mailing list