[opencms-dev] How to use v. 5 beta

Alexander Kandzior alex at opencms.org
Mon Nov 25 17:58:49 CET 2002


> > > When I actually use "template1," however, I do not get "Hello
> > > World" in the content of my new page, even though I've 
> > > correctly linked up the contenttemplate1 page.  I get 
> > > <[CDATA[]]> in the body of my content.
> > 
> > This is normal. To have a preset default body you need to 
> put another 
> > file in the "default_bodies" directory.
> 
> This sounds okay, but it sort of makes the contenttemplate 
> obsolete, doesn't it?  What purpose does contenttemplate 
> serve if I have to define the body template in the 
> default_bodies folder?  I see now that I have to choose the 
> new body template from a drop down list when I create a new 
> page, so the contenttemplate doesn't even provide a default 
> body for that particular template.  I'm still missing some 
> information here, it seems.

Ok i'll try to explain (but I think this is also explained somewhere in
the PDF docs):

A template usually consists of a) a "frametemplate" (bad naming, as this
has nothing to do with framesets) and b) a "contenttemplate". The
"template" combines these. Then there is the "body", which is what you
edit with a page. The structure is like

-frametemplate
  -contenttemplate
    -body

So you have 2 templates that wrap the body, not just one (as might be
expected). 

Why? Experience has shown that in a more complex sites you will usually
have only one "frametemplate", which might carry navigation, headline
and foot, but then you will probably have some "body" variations, let's
say body with newslist on the right side and body with newslist below
main text. For that you would create different "contenttemplates". 

> One more aggravation:  When creating the new body template, I 
> tried to use the HTML editor, but it didn't work.  The HTML 
> editor corrupted the XMLTEMPLATE and TEMPLATE tags that seem 
> to be required for the body template.  Am I going to be 
> required to create all my new bodies in the sourcecode 
> editor?  This kind of creates an administrative annoyance.

In case you want to create a template for "default_bodies", copy a file
from the /content/bodies directory to there.

The body file require a special format. Open the file
/system/workplace/templates/edit_options in the source editor. Set 

    var USE_BODYSELECTOR = true;
    var USE_NEWBODYOPTION = true;   

When you open the editor next time with a page, there should be options
to create a new body. Beware, as these do not always work (at least as
you or I would expect). Experiment with theses. Save your file. Open the
body file of the file in /system/bodies. You might get the idea. 


Best Regards,
Alex.

Alexander Kandzior
OpenCms Group / Alkacon Software





More information about the opencms-dev mailing list