[Zope] Store text directly in an DTML Document???

Trevor Toenjes zope@toenjes.com
Tue, 12 Mar 2002 08:02:46 -0500


Check out the Object Manager API in the Appendix of the Zope Book.
-----------
class DTMLDocument(ObjectManagerItem, PropertyManager)
A DTML Document is a Zope object that contains and executes DTML code. It is
useful to represent web pages.

manage_edit(data, title)
Change the DTML Document, replacing its contents with data and changing its
title.

The data argument may be a file object or a string.

Permission
Change DTML Documents
-----------

This is much cleaner to do in Python scripts and is the reccomended way in
Zope.
Here is a snippet to get you going...

Example:
# yourFolder is the Folder in which to create the new DTML_Document
yourFolder=getattr(container, container.yourFolder)

# create the document
yourFolder.manage_addProduct['OFSP'].manage_addDTMLDocument(someNewID,
                         title="Here is the title", file='Here is the
contents')
# add some string properties
doc=getattr(yourFolder, someNewID)
doc.manage_addProperty('myNewProperty', 'property text here', 'string')
doc.manage_changeProperties(title='you can change properties this way')

HTH
Cheers,
Trevor

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Breitenreicher, Marc
> Sent: Tuesday, March 12, 2002 7:36 AM
> To: 'zope@zope.org'
> Subject: [Zope] Store text directly in an DTML Document???
>
>
> Hi,
>
> can anyone tell me, if it's possible to store text out of a variable
> directly in an dtml-document??
>
> I know, I can directly change the title of a document with the following
> code:
> <dtml-call
> "_.getitem(mydocument).manageProperties(title=REQUEST.get('new_title'))">
>
> This writes the text of the variable 'new_title' into the title of the
> dtml-document 'mydocument'.
>
> I suppose, it is possible to change the content of a document the
> same way.
> But I don't know the attributs name.
>
> Who can help??
>
> Greetings
> Marc
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )