Re: [Zope3-Users] Rendering subobjects in pages

2007-08-06 Thread Hermann Himmelbauer
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  or
> something similar.
>
> Is it possible to render the person object using a single tal expression,
> , 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

-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Rendering subobjects in pages

2007-08-06 Thread Frank Burkhardt
Hi,

On Mon, Aug 06, 2007 at 09:51:18AM -0230, Greg Baker wrote:
> 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  or something 
> similar.
> 
> Is it possible to render the person object using a single tal expression, 
>  tal:content="context/person" />,

You may use a view which adapts Person() objects:

 
 
You have to define e view for Person() like this:

*browser/configure.zcml*
[...]
   
[...]

Don't forget to allow access to you Person()-class (e.g. via 
configure/class/allow).

[snip]

Regards,

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