[opencms-dev] Programmatically creating a site with the OpenCms API

Yves Glodt yg at mind.lu
Tue Apr 5 11:30:35 CEST 2011


Hi,

in the meantime I made some progress. This page was of help:

http://opencms-wiki.org/Write_a_file_programatically

I think I can do all I need using functionality of CmsObject (
http://www.opencms.org/javadoc/core/org/opencms/file/CmsObject.html )

Just one missing part would be file uploads.

Ideally I would like to upload a logo from my "Site Creator" page.

Does the OpenCms api allow to do custom file uploads where you can specify
the target location in the vfs?

Best regards,
Yves

On 3 April 2011 19:18, Yves Glodt <yg at mind.lu> wrote:

> Hi,
>
> imagine you have a "template site" in /sites/template, and it contains the
> following files:
>
>
>    - template.jsp
>    - site-config.jsp
>    - style.css
>    - index.html
>    - about.html
>    - contact.html
>
> Now what I would like to do is to is to create a "Site Creator" jsp page
> (which will be located in another site in fact, but that should not matter)
> which has a simple
> form to collect some data like e.g. the title, some color settings, logo
> selection, etc of the new site to be created.
>
> When that form is then being submitted I would like to create a subfolder
> in /sites/production (e.g. /sites/production/site01) and copy the files from
> /sites/template
> over there (and probably create a sibling to template.jsp). At the end the
> new site should also be published.
>
> Does anyone have some example code (CmsObject looks good to me) which could
> be useful in this case?
>
> Best regards,
> Yves
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20110405/27b0ee14/attachment.htm>


More information about the opencms-dev mailing list