[opencms-dev] how to get 2 blocks from the WYSIWYG editor on one page

Stephan Hartmann hartmann at waehrisch-feykes.de
Thu May 2 09:38:53 CEST 2002


Hi Dan,

My suggestion is:

>
> I create a master template (called master) that defines three elements:
> leftcol, rightcol and frametemplate, and then:
> <TEMPLATE>
> <ELEMENT name="frametemplate"/>
> </TEMPLATE>
>
> 'frametemplate' includes both the leftcol and rightcol templates:
> <![CDATA[
> <TD width="50%">
> ]]>
> <ELEMENT name="leftcol"/>
> <![CDATA[
> </TD>
> <TD width="50%">
> ]]>
> <ELEMENT name="rightcol"/>
> <![CDATA[
> </TD>]]>

This is ok so far, but use following elemntdefs:

<ELEMENTDEF name="leftcol">
<TEMPLATESELECTOR>leftcol</TEMPLATESELECTOR>
</ELEMENTDEF>

<ELEMENTDEF name="rightcol">
<TEMPLATESELECTOR>rightcol</TEMPLATESELECTOR>
</ELEMENTDEF>

The templateselectors reffer to text bodies you create in the WYSIWYG editor.
To preset text bodies for the WYSIWYG editor, create a new file in 
/content/default_bodies. Name it like your master template. You can choose it 
during page creation dialog.

<?xml version="1.0"?>
<XMLTEMPLATE>
<TEMPLATE/>
<edittemplate/>
<template name="leftcol">
<![CDATA[
]]>
</template>
<edittemplate name="leftcol">
<![CDATA[
]]>
</edittemplate>
<template name="rightcol"/>

<edittemplate name="rightcol"/>
</XMLTEMPLATE>

You can prefill the contents here in the CDATA blocks if you want.

Now when you create a new page choose this template and default body template.
When you edit this page you should see two text bodies besides the default 
body. 
In this way all happens in one page. I thing this is better than creating 
three pages.

> Both leftcol and rightcol are templates (and so show up in the template
> pulldown of the 'create new page' wizard).
>
> They both contain a reference to a content template that is named 'mybody'
> which does nothing more than contain this:
> <?xml version="1.0"?>
> <XMLTEMPLATE>
> <TEMPLATE> <ELEMENT name="body"/> </TEMPLATE>
> </XMLTEMPLATE>
>
> Well and good.  I can create a new leftcol page (lefttest1.html) and a new
> rightcol page (righttest1.html) and both the contents can be created with
> the WYSIWYG.
>
> But I can't for the life of me figure out how to have lefttest1.html and
> righttest1.html appear on the same page.
>
> Creating a page with the 'master' template, and editing it with the WYSIWYG
> editor gives both columns the same content (I assume because the body
> element is set to the same value for both templates).

This is because your elements use both "mybody" which usese the default body 
element that you edit in the WYSIWYG editor.

> The userguide has this to say (on page 52 of the PDF):
> "For every new page that is created with OpenCms the system automatically
> creates a page-control file. This page-control file determines the
> mastertemplate that is used by the new page and contains the element
> definition of the body element."
>
> I can't find the page-control file to do further examination, but I'm not
> sure I want to mess with this file, since it is automatically generated.

The page-control file is the file you create! if you create a file index.html 
in your root dir, this is the page-control file. you can view it by choosing 
"edit controlcode" from its context menu.

Let me know if that's what you wanted.

bye,
Stephan


-- 
Stephan Hartmann

Währisch & Feykes GmbH
Gustav-Adolf-Str. 5
47057 Duisburg
Tel. 0203 / 373 070
Fax 0203 / 376 766
hartmann at wfnetz.de

------------------------------------------------------
Ausschlusserklärung (Disclaimer):
Über das Internet versandte E-mails können unter fremden Namen erstellt oder 
manipuliert werden. Aus diesem Grund enthalten unsere mit E-mail verschickten 
Nachrichten grundsätzlich keine rechtsverbindlichen Willenserklärungen.



More information about the opencms-dev mailing list