Page Content as a Form Variable
I'd like to make an interface to edit the content of documents. I'm using special forms in propertysheets/methods. Now, just sticking document_src within a textarea breaks occasionaly dependant on the code within document_src. The ZMI escapes the souce of the document with < etc. #1) How exactly, in a DTML method in propertysheets/methods, can I get this out of an object? Normally I'd just call the filename, right? But when I'm in a method of its properysheet I can't really do that, I'm already is some sort of object-local namespace. I'm using <dtml-var document_src> to get the souce code. #2) There must be a convenient way of converting all those </> etc back into "real code". What is it? I'll pick apart the ZMI in the meantime, but I'm certain someone out there has the answer in their brains already.
#1) How exactly, in a DTML method in propertysheets/methods, can I get this out of an object? Normally I'd just call the filename, right? But when I'm in a method of its properysheet I can't really do that, I'm already is some sort of object-local namespace. I'm using <dtml-var document_src> to get the souce code.
#2) There must be a convenient way of converting all those </> etc back into "real code". What is it?
I'll pick apart the ZMI in the meantime, but I'm certain someone out there has the answer in their brains already.
So basically, you're asking how to round-trip content? #1) you need to HTML quote your output, or it will, as you've seen, break the heck out of the textarea. In DTML you can say <dtml-var document_src html_quote> to do this. There are ways of going about it in ZPT and Python Scripts too. #2) when you submit your form, this is taken care of. The HTML escape nonsense (< et al.) is a source-only artifact, and what you see in the browser is what your code will see after submission. Unless you're having problems with this, in which case: creepy. And your instinct to look to the ZMI is very good: it's a good place for examples. --jcc
participants (2)
-
Edward Pollard -
J Cameron Cooper