[opencms-dev] multiple content areas

Alexander Kandzior alex at opencms.org
Fri Jun 27 17:59:01 CEST 2003


Noel,

here's the short guide on how to enable such multiple content 
areas in the OpenCms WYSIWYGE editor with JSP templates:

1. In the OpenCms Workplace, open (in the txt editor) the file

/system/workplace/templates/edit_options

There are a couple of boolean values set. 
Change the line with BODYSELECTOR to:

var USE_BODYSELECTOR = true;

Save, exit and publish this file. 
If you now open any "Page" file in an editor, you should 
see a select box "Body:" beside the "Template:" selector.
The body should be "(default)" for all of your pages.
Obviously, the default body is the "normal" body that
is usually edited. 

2. Next you need to add bodies in your template. There a a couple
of ways to do this. There is even an option to enable in 
the user interface that can be activated in the edit_options,
but the behaviour is pretty strange so I do not recommend using this
feature. Also, you must make sure your templates always have the 
body parts in question (naming is important) so adding new 
bodies manually in the editor is not a good idea anyway. 

To get templates with more then the default body,
go to the "default_bodies" directory of any module, e.g.
the default module. In the default module,
there is a file "empty" in "default_bodies" with the 
title "Empty body". Copy this 
file, e.g. to a file "mybody" and change the title to
"My body file". Then change the content to something like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<XMLTEMPLATE>
    <TEMPLATE><![CDATA[ ]]></TEMPLATE>
    <edittemplate><![CDATA[ ]]></edittemplate>
    <template name="body2"><![CDATA[ ]]></template>
    <edittemplate name="body2"><![CDATA[ ]]></edittemplate>
    <template name="body3"><![CDATA[ ]]></template>
    <edittemplate name="body3"><![CDATA[ ]]></edittemplate>
    <template name="body4"><![CDATA[ ]]></template>
    <edittemplate name="body4"><![CDATA[ ]]></edittemplate>
    <template name="body5"><![CDATA[ ]]></template>
    <edittemplate name="body5"><![CDATA[ ]]></edittemplate>
    <template name="body6"><![CDATA[ ]]></template>
    <edittemplate name="body6"><![CDATA[ ]]></edittemplate>
    <template name="body7"><![CDATA[ ]]></template>
    <edittemplate name="body7"><![CDATA[ ]]></edittemplate>  
    <template name="body8"><![CDATA[ ]]></template>
    <edittemplate name="body8"><![CDATA[ ]]></edittemplate>
    <template name="body9"><![CDATA[ ]]></template>
    <edittemplate name="body9"><![CDATA[ ]]></edittemplate>

</XMLTEMPLATE>

3. Now create a new "Page" as usual with the "Wizard" symbol. 
In the "Create new page" dialog there is an option 
"Copy body from". This should now list your "My body file"
as well. Select this as the body file for your page.

Open the page in the editor. The "Body:" selector should now have
the "(default)" and also "body2" to "body9" available. 
You can now edit each of the bodies separatly. 

Note: As you can probably guess the naming of the bodies is 
up to you, so instead of "body2" you can use some name like
"header_text", "foot_text" or whatever. 

4. Now the only thing to do is make use of the additional bodies 
in your templates. 

Usually, you use something like 

<cms:include element="body" />

to include the body element. 
To include e.g. "body2" use:

<cms:include element="body2" />

This should be about it. 


Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com


> -----Original Message-----
> From: opencms-dev-admin at opencms.org 
> [mailto:opencms-dev-admin at opencms.org] On Behalf Of Noel Gelineau
> Sent: Monday, June 23, 2003 9:28 PM
> To: opencms-dev at opencms.org
> Subject: [opencms-dev] multiple content areas
> 
> 
> I've been trying to define multiple content areas using JSP 
> templates but I can't seem to quite get there.  I've enabled 
> the multiple content view for the WYSIWYG editor which is 
> fine.  Can somebody give me a very simple example on how the 
> XML and JSP template files would look like for 2 content areas.
> 
> Thanx,
> Noel
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, 
> please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
> 




More information about the opencms-dev mailing list