[opencms-dev] siblings, templates

Olli Aro olli_aro at yahoo.co.uk
Mon Mar 31 10:50:48 CEST 2008


Well the problem here is that OpenCms has one-to-one mapping between pages
and templates over the "template" property. This means that if you want to
make this to one-to-many then you will need to do some clever stuff in
templates. 

The above does not mean that you will need to change the "template" property
for all of your pages in your current OpenCms deployment, if you decide to
start rendering a different template for e.g. different sections of your
website. The way to do this is to take the template your "template" property
currently points to and add some logic there to decide on the correct
template.

For example:

If you current template is called "templateA". Copy templateA to templateB.
Create your new template "templateC". Write logic in your new templateA, so
that some requests go to templateB and the others go to templateC.

Regards,

Olli

-----Original Message-----
From: Christoph P. Kukulies [mailto:kuku at physik.rwth-aachen.de] 
Sent: 28 March 2008 14:07
To: olli_aro at yahoo.co.uk; The OpenCms mailing list
Subject: Re: [opencms-dev] siblings, templates

On Fri, Mar 28, 2008 at 12:53:38PM +0000, Olli Aro wrote:
> Hi Chris,
> 
> Yes this is definitely possible, you just need to build the required logic
> in your master template meaning the JSP where your "template" property
point
> to is just controller including another JSP for the correct template e.g.
> based on a property value inherited from folder, URL pattern or something
> else.

Yes, that is, what I meant by "changing the template". Sure, that could
be done. But I thought of some "builtin" in OpenCms that does the trick.


--
Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de
> I'm running opencms 6.2.3 (in the production version, 7.0.4 soon to come)
> in a multisite environment.
> 
> We have some pages that have the same content but have to appear in
> different sites with their different templates associated to them.
> 
> Now our sectretaries who are doing the content editing are groaning
> about having to maintain the same contents in different locations.
> 
> Is there a way such that a page kind of "inherits" the template from
> it's parent folder or some other mechanism that could solve that
> problem? 
> 
> Well, I could confine the contents to a single file and include it
> but that would require changing the templates etc. etc.





More information about the opencms-dev mailing list