[opencms-dev] cms:vfs get content of page element

Yves Glodt yg at mind.lu
Mon Jul 27 15:42:05 CEST 2009


On Friday 24 July 2009 19:54:35 Achim Westermann wrote:
> Hi Yves,

Hi Achim,

> > I tried it but in my (probably special) case it did not work. I just get
> > no more content rendered as soon as I add the c:set
>
> The <c:set> ... does not render anything. <cms:include>.. Grabs the
> content and would render it. <c:set> sets the output of <cms:include>
> into a pageContext attribute called "myvar". That's why you can use
> ${myvar} later in your jsp.

I am aware of this, but it does not work as expected.
As soon as I put the cms:include inside the c:set, "page execution stops" at 
the c:set... Look:

When I just do:
<cms:include file="/en/op2/index.html" element="body" />
<p>Test</p>

I get as expected the content included in my page, and after the string "Test" 
is also rendered.


Now, when I do this:
<c:set var="hallo">
<cms:include file="/en/op2/index.html" element="body" />
</c:set>
${hallo}
<p>Test</p>

I do not see anything, not even "Test"...

Strange....

but the good news is that I found another way in the meantime:

<c:set var="page" 
value="${cms:vfs(pageContext).readXml['/en/op2/payment.html'].value['introtext']}" 
/>
${page}

Works!



> Your page.html is of type "xmlpage"? And has the node "content" in it's
> control code?
>
> Also <cms:include> might not return anything if the locale (attribute in
> the XML of the included file) is different from the current locale
> (aCmsJspActionElement.getRequestContext().getLocale()). Then you could
> add the __locale=<languagecode> request parameter nested in the
> <cms:include> tag as shown in the Alkacon taglib documentation.
>
> I might not be able to give further answers for over a week. Good luck!
>
> Kind Regards,
> Achim.
>
> -------------------
> Achim Westermann
>
> Alkacon Software GmbH  - The OpenCms Experts
> http://www.alkacon.com - http://www.opencms.org



More information about the opencms-dev mailing list