[opencms-dev] Template selection for XMLContent

Olli Aro olli_aro at yahoo.co.uk
Wed Nov 15 15:00:51 CET 2006


Jon,

 

You are absolutely right; the template-elements property is just like
template property for the xmlpage. What I was hoping was that the
template-elements property would only define the view for the actual content
and not for the whole page to be rendered.

 

I think I will try to implement the following model and this will allow me
still to have everything the same way I had implemented it before:

 

1)       I will introduce the template dropdown to the form used to create
structured content.

2)       I will modify the JSPs referenced from template-elements just to
include the main template as below:

 

<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<c:set var="temp_template"><cms:property name="template"/></c:set>

<c:if test="${!empty temp_template}">

      <cms:include><c:out value="${temp_template}" /></cms:include>

</c:if>

 

3)       I will introduce new page property called "body-template" for
structured content, which points to a new JSP that renders only the content
part for structured content.

4)       Now I can drop in the structured part of the content anywhere in my
template by using the following include:

 

<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<c:set var="temp_body_template"><cms:property name="body-template"/></c:set>

<c:if test="${!empty temp_body_template}">

      <cms:include><c:out value="${temp_body_template}" /></cms:include>

</c:if>

<c:if test="${empty temp_body_template}">

      <cms:include element="body" editable="true" />

</c:if>

 

Regards,

 

Olli

 

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Jonathan Woods
Sent: 15 November 2006 09:37
To: 'The OpenCms mailing list'
Subject: RE: [opencms-dev] Template selection for XMLContent

 

Olli -

 

It may be me who's confused - I'm not sure!

 

By 'normal content', I presume you mean resources which are of type xmlpage
(tell me if I'm wrong).  These aren't fundamentally any different from
resources of any other XML content type: they contain data, held in XML
elements, which a JSP then includes at various points in its output.

 

The only difference is in the way OpenCms chooses to associate a resource
with the JSP used to include bits of it.  For xmlpage resources, you get to
choose a JSP at resource creation time, and this sets the 'template'
property to the path of the JSP; for arbitrary XML content types, the JSP is
determined from the value of the path contained in the 'template-elements'
property.

 

Actually, there's another difference which might explain the confusion, but
the difference isn't anything fundamental: for xmlpage resources, the
WYSIWYG editor is fired up rather than the horrible XML content editor.  But
in both cases, there's still the same relationship between view and data;
they're not inverses of one another.  When you fire up the WYSIWYG editor
for xmlpages, you're not injecting stuff into the template; you're injecting
data into the XML document / the instance of an xmlpage resource.  You could
say that for other XML content types, you use the XML content editor to
inject data into their XML document instances - no difference.

 

The word 'template' has become very confusing where OpenCms is concerned, I
guess because of the legacy mechanism used in OpenCms 5 (and before?).  For
both xmlpage resources and your own XML content items, the so-called
template is really a "renderer" or a "view".

 

Jon

 

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Olli Aro
Sent: 14 November 2006 21:57
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Template selection for XMLContent

Yes, I suppose what got me confused is that while with normal content you
inject the content in template (using e.g. <cms:include element="body"/>),
while with the XMLContent you kind of inject the template to the content. I
was hoping that I could have done something like <cms:include
element="newsbody"/> and  that  then would have called the view JSP in order
to inject the XMLContent view to my generic template. 

 

The current design also means that if people wish to use the default OpenCms
content types within their own templates (other than TemplateOne), they have
to rewrite all view JSP for the content types, which is a shame. Or am I
still missunderstanding this?

 

Also, how do you share the content types e.g. between 2 different sub sites
with the current framework? Other than building some logic in the template
to cope with this as you were suggesting earlier.

 

Sorry to keep going on about this, but I still find it a bit confusing...

 

Olli

 



 

----- Original Message ----
From: Jonathan Woods <jonathan.woods at scintillance.com>
To: The OpenCms mailing list <opencms-dev at opencms.org>
Sent: Tuesday, 14 November, 2006 6:06:25 PM
Subject: RE: [opencms-dev] Template selection for XMLContent

No idea why - I guess the designers felt that an article's an article, a
calendar entry is a calendar entry, and so on... so there'd need only be one
way for the content item to be rendered.

 

Of course, your custom XML content could contain a data item which itself
gives a cue to the template-elements JSP about how to render the content,
and your JSP could take notice of this value accordingly.

 

Jon

 

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Olli Aro
Sent: 14 November 2006 17:50
To: 'The OpenCms mailing list'
Subject: RE: [opencms-dev] Template selection for XMLContent

Yes you are right, it is the traditional way. I just have used only
cms:includes in my templates before, so concept of cms:template elements is
new to me and means that I have to restructure my templates in order to get
XMLContent working properly :-( 

 

Regarding the missing template dropdown - any ideas why this has been
dropped out for XMLContent and would it be easy to put it back in? I could
imagine that users might still want to select between different templates
for their XMLContent as well.

 

Olli  

 

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Jonathan Woods
Sent: 14 November 2006 17:22
To: ' The OpenCms mailing list '
Subject: RE: [opencms-dev] Template selection for XMLContent

 

This is the same as a traditional template, isn't it?  Except that the user
can't select from a drop-down which JSP is used to perform the rendition.

 

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Olli Aro
Sent: 14 November 2006 16:39
To: ' The OpenCms mailing list '
Subject: RE: [opencms-dev] Template selection for XMLContent

Aaah, so it looks like OpenCms expects property template-elements to be
populated for all XMLContent and then you have to define there references to
template headers and footers. Is there any way to switch this functionality
off and use a "traditional" template for XMLContent?

 

Regards,

 

Olli 

 

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Olli Aro
Sent: 14 November 2006 15:47
To: ' The OpenCms mailing list '
Subject: RE: [opencms-dev] Template selection for XMLContent

 

Yes that gets me the content from the XML content items, but how do I get
the template around the content area (all navigation menus etc.)? If you
create a normal content item you get the selection list where you can then
select e.g. TemplateOne, but XMLContent does not seem to have this selection
list.

 

Olli

 

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Jonathan Woods
Sent: 14 November 2006 15:39
To: ' The OpenCms mailing list '
Subject: RE: [opencms-dev] Template selection for XMLContent

 

If on a particular resource you set the value of the property called
'template-elements' to the path of a JSP, then OpenCms will 'call' that JSP
when a user requests that resource.  Of course, the action of the JSP is
normally to include data from the XML content item, i.e. to act as its view,
but not necessarily so.

 

Jon

 

  _____  

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Olli Aro
Sent: 14 November 2006 12:00
To: ' The OpenCms mailing list '
Subject: [opencms-dev] Template selection for XMLContent

Hi all,

 

I am trying to surround XMLContent with a template and noticed that when a
user creates a new XMLContent item there is no selection for template. Do I
need to exit the creation JSP in order to introduce this for XMLContent or
is there a different way in order to allow the users to select template for
their XML content?

 

Regards,

 

Olli 

 

 

 

_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev

 

 

  _____  

All
<http://us.rd.yahoo.com/mail/uk/taglines/default/nowyoucan/pc_mag/*http:/us.
rd.yahoo.com/evt=40565/*http:/uk.docs.yahoo.com/nowyoucan.html>  new Yahoo!
Mail "The new Interface is stunning in its simplicity and ease of use." - PC
Magazine

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20061115/eddaa799/attachment.htm>


More information about the opencms-dev mailing list