[opencms-dev] Use of cms:includ>

Florian Hopf hopf at synyx.de
Wed May 23 11:39:10 CEST 2007


William T. Mann wrote:
> Florian Hopf ha scritto:
>> Hi,
>>
>> William T. Mann wrote:
>>> However, if I try to do it dynamically it won't work:
>>>
>>> <cms:contentcheck ifexists element="Sector">
>>>     <p>Sector: <cms:include file="<cms:contentshow element="Sector"/>"
>>> element="Description" /></p>
>>> </cms:contentcheck>
>>>
>>> This gives an error. Is it possible? What am I missing?
>>>
>> Did you try
>>
>> <cms:include>
>>     <cms:contentshow element="Sector"/>
>> </cms:include>
>
> I tried that but then I get an unknown error that doesn't return a
> message. However, I discovered that if I set up a request attribute
> and then use the attribute in the include statement it works. My
> problem then becomes how do I set up an attribute using the value from
> a content field? I'd like to do something like this:
>
> <% request.setAttribute("page", <cms:showcontent element="Sector"/>); %>
>
> which obviously doesn't work. Is something like this possible though?
> Thanks for the help.
>
If you use JSTL you can use
<c:set var="page" scope="request">
<cms:showcontent element="Sector"/>
</c:set>

Kind regards
Florian



More information about the opencms-dev mailing list