[Zope] Displaying the text content of a ZClass

Alexandre Ratti alex@gabuzomeu.net
Fri, 10 Dec 1999 21:00:06 +0100


Hello,


I eventually found a solution for the problem described below.

Summary: I have a ZClass that subclasses DTMLDocument. In the ZClass 
product folder, I have an index_html method that provides a default view 
for ZClass instances. I want this method to display both property values 
and the text content of the ZClass instance.

To display the text content, if I use <dtml-var raw>, the text is displayed 
in unrendered form. Text and HTML code are OK but nested DTML is not 
interpreted. To display the text content in rendered form, I need to use 
<dtml-var "_.render(this())">.

Example code for index_html:

<dtml-var standard_html_header>
  <H2 align="center"><dtml-var title_or_id></H2>

<P><EM><dtml-var myDateProperty></EM><BR>
<dtml-var myDescriptionProperty></P>

  <dtml-var "_.render(this())">
<dtml-var standard_html_footer>


If there is a better way please let me know.


Cheers.

Alexandre


At 11:44 07/12/1999 +0100, Alexandre Ratti wrote:
>At 16:59 06/12/1999 -0500, Michel Pelletier wrote:
>> > => How can I display the rendered text content for a ZClass?
>> > It sounds
>> > simple but I'm stuck.
>> >
>> > => I'll rephrase the question: imagine you want to wrap DTML
>> > Methods in a
>> > ZClass to make them CatalogAware and add custom properties.
>> > How do you
>> > display the content of the ZClass instances ?
>>
>>I would think you could just call the ZClass instance like any other
>>DTML Method:
>>
>><dtml-var myZClassInstance>
>
>
>That's not what I meant: within your ZClass (in the Products folder), you 
>need to create an index_html method to define the default view for your 
>ZClass. Eg.:
>
>-YourProduct
>   -YourZClass
>      - index_html
>      - formEditProperties
>      ... other methods
>
>index_html will be mapped to the ZClass View tab in Views.
>
>What I mean is: how can you access the text content of the ZClass from 
>within index_html? How to you show the text content? If I use <dtml-var 
>raw>, embedded DTML is not interpreted.

<snip>