[opencms-dev] Creating templates with place holders

Frans Postma fpostma at xs4all.nl
Wed Mar 16 11:58:49 CET 2005


Hi,
(researching this some more has been most educational, thanks :)

In the editor you will see something called 'element' which is a dropdown. Now look at the properties of a template (advanced) and
specificly at one called "template-elements". You will notice one or more names there, one is followed by a *. That is the default
element, the one which the WYSIWYG editor will automaticly let you edit.

I.e. "element1*,element2,element3*" will give the page based on this template 3 elements. Of those 3 only element1 and element3
are directly/immidiatly visible in the editor dropdown. The other element must be 'activated' using the Elements button in the
editor. Element1 and 3 are known as 'required', they will always be in the page, even if empty.

See opencms\src\org\opencms\workplace\editors\CmsDialogElements.java for more specifics.

Next you can include those elements like this:

	<cms:include element="element1"/>

Note that endusers will edit content on a per-element basis. Which means they won't see WHERE there input will be displayed
exactly in the WYSIWYG editor.


The very basic includetest template.jsp looks as follows:

<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<!-- requires element1 and element2 to be defined in the template-elements property of
 this template !!! Otherwise not much will happen ;-) -->

<cms:template element="head">
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><title>Test Include</title></head>
<body>
</cms:template>
<cms:template element="body">
<table border=3>
<tr><th>element1</th><th>element2</th></tr>
<tr>
	<td><cms:include element="element1"/></td>
	<td><cms:include element="element2"/></td>
</tr>
</table>
</cms:template>

<cms:template element="foot">
</body>
</html>
</cms:template>
=== end template file
 

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Chitra Prasad
> Sent: woensdag 16 maart 2005 5:01
> To: The OpenCms mailing list
> Subject: RE: [opencms-dev] Creating templates with place holders
> 
> Hi
> 
> Does this mean that the content editors get to see the 
> placeholders and all they are allowed to do is change the 
> content only and not the html that is used in the layout?
> 
> Thanks,
> Chitra.
> 
> 
> 
> 
> ----- Original Message -----
> From: "Frans Postma" <fpostma at xs4all.nl>
> To: "'The OpenCms mailing list'" <opencms-dev at opencms.org>
> Subject: RE: [opencms-dev] Creating templates with place holders
> Date: Tue, 15 Mar 2005 20:29:52 +0100
> 
> > 
> > Sure, just define multiple elements in the 'elements' property of 
> > the template. Then you can include those elements for use in the
> > template using: cms.include("","body1","") or 
> > cms.include("","another_element","") and such (I believe that is 
> > the proper syntax,
> > not at work right now:-)
> > 
> > Anyway, just define elements with some names. Users can edit those 
> > in the editor, just make sure to actually include/place all the
> > defined elements in the template :)
> > 
> > Frans
> > 
> > > -----Original Message-----
> > > From: opencms-dev-bounces at opencms.org 
> > > [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Chitra 
> > > Prasad
> > > Sent: dinsdag 15 maart 2005 13:41
> > > To: opencms-dev at opencms.org
> > > Subject: [opencms-dev] Creating templates with place holders
> > >
> > > Hi All,
> > >
> > > I am trying to build a template, in which i want to be able to 
> > > fix the layout of the body, which means the users using this 
> > > template will not be able to change the layout of the page but 
> > > just be able to change the content in the place holders. The 
> > > place holders will be a part of the template, is this possible?
> > >
> > > Thanks
> > > Chitra Prasad
> > >
> > > -- _______________________________________________
> > > NEW! Lycos Dating Search. The only place to search multiple 
> > > dating sites at once.
> > > http://datingsearch.lycos.com
> > >
> > >
> > >
> > > _______________________________________________
> > > 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
> 
> 
> 
> Chitra Prasad
> 
> -- 
> _______________________________________________
> NEW! Lycos Dating Search. The only place to search multiple 
> dating sites at once.
> http://datingsearch.lycos.com
> 
> 
> 
> _______________________________________________
> 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