[opencms-dev] about <cms:contentcheck> tag

Stephan Hartmann beffe at beffe.de
Thu Nov 18 22:40:09 CET 2004


Hi Alex,

here is the patch.

Tag contentshow now has two more attributes, "var" and "scope", that mainly
behave like in the set tag of the jstl core lib.
Examples:
<cms:contentshow var="test" element="Title" />
stores the value of the element title in a page-scoped (default) variable
called test.
Tests can now be performed like this:
<c:if test="${!empty test}"><c:out value="${test}"/></c:if>

If an element occurs multiple times, the var will become a list instead of a
string:
<cms:contentshow var="myTeasers" element="Teaser" />
<c:forEach var="myTeaser" items="${myTeasers}">
  <c:out value="${myTeaser}"/>
</c:forEach>

If you ommit the element attribute, var will become a map:
<cms:contentshow var="elements" />
<c:forEach var="element" items="elements">
  <c:out value="${element.key}" /> <c:out value="${element.value}" />
</c:forEach>

Regards,
Stephan

PS: Why not use java conventions for the tag names, i.e. contentShow?

----- Original Message -----
From: "Alexander Kandzior" <alex at opencms.org>
To: "'The OpenCms mailing list'" <opencms-dev at opencms.org>
Sent: Monday, November 15, 2004 1:13 PM
Subject: RE: [opencms-dev] about <cms:contentcheck> tag


Stephan,

Sounds like a good idea. As you probably know the implementations of the
contentXXX tags are in org.opencms.jsp in the CmsJspTagContentXXX classes.
If you could provide a patch against these that would be great.

FYT: It's likley that the "index" attribute of the "contentshow" tag will be
removed soon. The replacement mechanism is already in place, you will have
to <contentshow element="Title[0]"/> instead of <contentshow element="Title"
index="0"/>.

Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com



> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of
> Hartmann, Waehrisch & Feykes GmbH
> Sent: Monday, November 15, 2004 11:55 AM
> To: The OpenCms mailing list
> Subject: [opencms-dev] about <cms:contentcheck> tag
>
> Hi Developers, hi list,
>
> first of all i have to say that the new XML content mechanism
> ist quite exactly what OpenCms was missing most. Thanks for it!
>
> In a current project i came to the point where i had to
> create a new XML content which is not too complex but needs
> some conditional checking to decide which content to show.
> The contentcheck-tag seemed to be the way to check the
> existance of a value, but i found it not very useful. It only
> checks if the XML Content contains the defined element(s) but
> does not check if it is empty or not.
> But in most cases you already know which elements an XML
> content contains but you need to know if they are empty or not.
> A simple example is to display a link only if it is not empty.
>
> Anyway, i thought there is already a very powerful tag
> library to perform conditional checks, so i turned to use the
> jstl. It is just a little cumbersome to bring the values to
> scoped variables. Therefor it would be nice to have an
> additional attribute "var" for the contentshow tag to expose
> the value of the named element to this variable instead of
> writing it to the output. If no element is given, export all
> elements to a map. Elements that occur multiple times would
> become a list.
>
> The implementation should be quite simple and if others will
> find it useful i will see if i can do it.
>
> Regards,
> Stephan
>
>
> Stephan Hartmann
>
> Unternehmensberatung Währisch & Feykes GmbH Gustav-Adolf-Str.
> 5, 47057 Duisburg
> eMail: hartmann at waehrisch-feykes.de
> Internet: www.waehrisch-feykes.de
> Tel. +49 203 373070, Fax. +49 203 376766
>
> Ausschlusserklärung (Disclaimer):
> Über das 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.
>
>
>
>
> _______________________________________________
> 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

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20041118/df006eed/attachment.txt>


More information about the opencms-dev mailing list