OK, I'm going nuts trying to get this to work. What I want to do is to replace the contents of a HTML file with the contents of a variable I have, using DTML, in a similar way to that way the Zope manager Edit tab does it. Seems simple enough, but every combination I try seems to fail. The object reference is fairly minimalist which makes it difficult to work out how to use all these methods, and I can't find any DTML examples. Do I use manage_upload or manage_edit? How do I reference a file called "myfile.html"? eg: (my latest non-working code) <!--#with "_.getitem('content.html')"--> <!--#call manage_upload(REQUEST.newcontent)--> <!--#/with--> Cheers, Martin -- ### Martin Dougiamas -- Internet Agent is == i see ### Centre for Educational Advancement ### http://cea.curtin.edu/staff/martin
I'm following up my own message, for the benefit of the archives, with a good working solution I received from Ben Chapman, included below. Martin Dougiamas wrote:
What I want to do is to replace the contents of a HTML file with the contents of a variable I have, using DTML, in a similar way to that way the Zope manager Edit tab does it. Seems simple enough, but every combination I try seems to fail.
Ben's solution is included below:
Date: Wed, 28 Apr 1999 00:36:01 -0500 From: Ben Chapman <bchapman@utulsa.edu> Organization: University of Tulsa College of Law To: martin@dougiamas.com
Martin:
In response to your question about updating a document based on the content of a form variable, this seems to work for me:
I have a document called "intro" that contains text.
I have a document called "intro_update" that contains this:
<form action="process_update" METHOD="POST"> <textarea wrap="off" name="data:text" rows="20" cols="50"> <!--#var intro--> </textarea><BR> <input name="Submit" type="Submit"><input name="Reset" type="Reset"> </form>
"process_update" looks like this:
<!--#var standard_html_header--> <!--#if data--> <!--#call "intro.manage_edit(_.getitem('data'),'')"--> <P>Your document was successfully updated. <!--#else--> No data entered!<BR> <!--#/if--> <!--#var standard_html_footer-->
And this works great for me, too. :-) Thanks, Ben. Cheers, Martin -- ### Martin Dougiamas -- Internet Agent is == i see ### Centre for Educational Advancement ### http://cea.curtin.edu/staff/martin
participants (1)
-
Martin Dougiamas