[opencms-dev] multiple content areas

Noel Gelineau ngelineau at greenridge.ca
Fri Jul 18 00:17:01 CEST 2003


Alex and everyone, this works for me: 

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmltemplate>
  <stylesheet>/system/modules/org.opencms.welcome/resources/welcome.css</stylesheet>

  <template><element name="jsptemplate"/></template>

  <template name="body2"><element name="jsptemplate"/></template>
  <edittemplate name="body2"><element name="jsptemplate"/></edittemplate>

  <elementdef name="jsptemplate">
    <class>com.opencms.flex.CmsJspTemplate</class>   
    <template>../jsptemplates/welcome.jsp</template>
  </elementdef>
</xmltemplate>

Thanx for the help.

Noel

-------------------

Noel,

your example shows the mastertemplate. This you need to get to your
jsptemplate. Step 4 describes how to use the additional bodies in the
jsptemplate. I suggest you experiment and try out a few things. It
should come to you after a while ;-)

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: Tuesday, July 15, 2003 4:50 PM
> To: opencms-dev at opencms.org
> Subject: [opencms-dev] multiple content areas
> 
> 
> Thanks for the feedback Alex, but it doesn't seem to work, I 
> believe I'm missing something.  From what you've given me, 
> there seems to be nothing to indicate the relation between 
> the XML and JSP template files.  The example modules have 
> something like this as their XML template:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xmltemplate>
>   
> <stylesheet>/system/modules/org.opencms.welcome/resources/welc
> ome.css</stylesheet>
>   <template><element name="jsptemplate"/></template>
>   <elementdef name="jsptemplate">
>     <class>com.opencms.flex.CmsJspTemplate</class>   
>     <template>../jsptemplates/welcome.jsp</template>
>   </elementdef>
> </xmltemplate>
> 
> Which is very different from what you've given me. Maybe it's 
> a combination of the both?
> 
> Noel
> 
> 
> -------------------------
> 
> 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
> > 
> > 
> _______________________________________________
> 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