[opencms-dev] contenload & include
Ruben Malchow
ruben at disk0.de
Tue Aug 4 09:53:33 CEST 2009
and another one ... any way to get values from the content into the
collector and param attributes?
this doesn't do the trick:
<cms:contentload
collector="singleFile"
param="%(opencms.filename)">
<cms:contentloop element="main_area_component">
<c:set var="collector">
<cms:contentshow
element="collector"/>
</c:set>
<c:set var="param">
<cms:contentshow
element="param"/>
</c:set>
<cms:contentload
collector="${collector}"
param="${param}">
</cms:contentloop>
</cms:contentload>
Ruben Malchow schrieb:
> hi christian,
>
> well ... the "template" property is not set at all ... now you speak of
> it, can anyone describe the reasoning behind these two properties?
>
> anyway, what i do now is this (and it works like a charm):
>
> <cms:contentload
> collector="allInFolderPriorityTitle"
> param="/path/|999">
>
> <c:set
> var="file">
> <cms:contentshow element="%(opencms.filename)"/>
> </c:set>
>
> <c:set var="template">
> <cms:property
> name="template-elements" file="${file}"/>
> </c:set>
>
> <cms:include page="${template}">
> <cms:param
> name="file">
> <c:out value="${file}"/>
> </cms:param>
> <!--- ... other params -->
> </cms:include>
>
> </cms:contentload>
>
> so i don't include the content, but the template, and pass the content
> as a parameter. now, this has one drawback, which is that the template
> will have to know how use the parameter ...
>
> anyway, i think also there might have been an JSTL / EL vs OCMS macro
> issue ...
>
>
> Christian Steinert schrieb:
>> Ruben Malchow wrote:
>>> hello list,
>>>
>>> i have a little question about taglib usage ... first, here's what i
>>> want to do:
>>>
>>> <cms:contentload
>>> collector="allInSubTree"
>>> param="/articles/|999">
>>>
>>> <c:set
>>> var="file">
>>> <cms:contentshow
>>> element="%(opencms.filename)"/>
>>> </c:set>
>>>
>>> including: <c:out value="${file}"/>
>>> <!---
>>>
>>> here, i want to actually include that file, passing
>>> some parameters instructing it to render itself
>>> slightly different than normal
>>>
>>> -->
>>>
>>> </cms:contentload>
>>>
>>>
>>>
>>> so, the template assigned to the "articles" knows how to render itself
>>> as a complete page, but also, it takes parameters controlling that
>>> behavious. mainly, i have two parameters, the first one controlling
>>> wether or not to render the entire article or just the headline and
>>> abstract, the second one controlling wether or not to include the full
>>> html header and footer and whatnot.
>>>
>>> what i want to do is include the html snippet produced by this template
>>> in a list using only taglib things ... so far, i have been unable to,
>>> biggest problem being a NPE being raised whenever i try to "include" an
>>> XmlContent - even if it is a fixed path:
>>>
>>> <cms:include page="path/to/someXmlContent.html" />
>>>
>>> gives me a NPE, while:
>>>
>>> <cms:include page="path/to/somePlainTextFile.txt" />
>>>
>>> works perfectly ok .... i guess there is something about the include tag
>>> i didn't quite understand yet? if anyone knows what it is .... well,
>>> help and hints appreciated :)
>>>
>>> i have done it using actual java code before, but the point here would
>>> be to do as much as possible in taglibs ... and i think it must be
>>> doable ...
>>>
>>>
>> Could this be a problem with an incorrect template and/or
>> template-elements property for the xml file that you try to include?
>> Make sure that both of these properties are present and correctly set.
>>
>> Also, please try to see, if cmsJSPActionElement.include will REALLY work
>> for the exact same file that you have problems with when using the
>> cms:include tag. Normally, either both ways should work or both ways
>> should fail.
>>
>> Christian
>
> _______________________________________________
> 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
>
More information about the opencms-dev
mailing list