[opencms-dev] Create a sibling dynamically

Mario Jäger m.jaeger at alkacon.com
Mon Jul 25 10:17:57 CEST 2011


Hi,

You do not write if you want to have the sibling for all resource types 
or for a special resource type only.

If you only want to have it for a special resource type and that is a 
xml content for example, then you could create a new class which extends 
the class org.opencms.file.types.CmsResourceTypeXmlContent and which 
overrides the method createResource(). In that method you could 
implement that aditional to the new resource automatically the sibling 
in the other site path is created. That new class is to configure in the 
WEB-INF/config/opencms-modules.xml in the "class" attribute in the 
<resourcetypes><type> node from the special resource type. The new class 
should be in your own module.

There is a possibility already to configure that other resources are 
created automatically when a new resource is created with the 
<copy-resources> node in the opencms-modules.xml. But, you can not use 
that configuration element for your requirement without to make 
enhancements on that feature. I would advice to use that possibility 
only if you want to have siblings for all resource types. Because, I 
think it is more complicated to enhance that configuration element to 
your requirement without to touch the OpenCms core.

Kind Regards,
Mario.



Am 21.07.2011 10:23, schrieb R. Jonyo:
>
> Hi,
>
> Anyone who has code to create a sibling dynamically?
> e.g. i manually create a resource on "/sites/default/test.html" and a
> sibling is automatically created on " /sites/mysite/test.html". I guess on
> has to use ModuleAction but i do not have the right code. Please help!
>
>
>
> regards,
> R.Jonyo


-- 
-------------------
Mario Jäger

Alkacon Software GmbH  - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org



More information about the opencms-dev mailing list