[opencms-dev] Writing HTML directly into a vfs file
Matthias Schmidt
matthias.schmidt at gmx.de
Mon Jun 30 22:01:01 CEST 2003
Well, there's this file with type "page", say "/myFile.html".
The HTML content is in an XML file in /system/bodies/ with the same
name, so in this case "/system/bodies/myFile.html".
And I guess there must be some way to find the file in system/bodies/
and then to insert the new HTML content.
It would look something like this (in my 'dream' ;)):
CmsFile xmlFile = CmsFile.getMeTheSystemBodiesFile();
xmlFile.insertTheNewHtmlContent("<html>...</html>");
I looked all my way through the CmsObject and CmsFile and CmsResource.
Got any hints?
David Currie wrote:
> Hi Matthias.
>
> Can you be a little more specific about what you are trying to do? I
> have various fragments of code I've written that might help you, but I
> need to know more about the context. Are you going to do this from a
> Content Definition? A JSP? A class called from a JSP? etc.
>
> Basically, you should look at the CmsResource.createResource() calls.
> You need to have a CmsResource object available, which is why I asked
> those questions above.
>
> By the way, /system/bodies/* is only used for files of type PAGE. If
> you just want to create a PLAIN file in the VFS, all you have to do is
> include the file path and body in the arguments to createResource() and
> you're done.
>
> Hope this helps.
>
> Dave
>
> On Fri, 2003-06-27 at 12:13, Matthias Schmidt wrote:
>
>>Hi list,
>>
>>I have to write a Class that can directly write HTML code into a file in the
>>vfs. I know that the file content of a file
>>
>>/myfile.html
>>
>>really is stored in a file
>>
>>/system/bodies/myfile.html
>>
>>inside an XML tag. I guess, there MUST be an OpenCms method that does
>>exactly that for me, but I cannot find it. Has anybody got a hint for
>>me? The Code
>>and HTML editors must be using it, but I still cannot find it.
>>
>>Thanks in advance!
More information about the opencms-dev
mailing list