Hi Grégory
A late thanks for your reply. Unfortunately I must still be doing something
wrong, 'cause I'm getting nothing but Freemarker template errors.
This is my content node iterator:
[@cms.contentNodeIterator contentNodeCollectionName="linkList"
varStatus="status"]
[@cms.includeTemplate /]
[/@cms.contentNodeIterator]
And in my template I've added
${ctx.pageContext.status.index}
And I tried ${ctx.pageContext.getAttribute("status").index} and many other
things even down to ${ctx.pageContext.class.name}, but whatever I do, I get:
FreeMarker template error!
Expected hash. ctx.pageContext evaluated instead to
freemarker.ext.jsp.FreeMarkerPageContext2
Any ideas?
Thanks!
-will
On 01.03.2011, at 15:39, Grégory Joseph wrote:
>
> Ok, several things:
>
> According to the code of ContentNodeIterator, "varStatus" is store in the
> pageContext. So you'd need to do
> ${ctx.pageContext-dot-whatever-the-pageContext-api-looks-like}.
>
> Another approach you might want to try, if only out of curiosity - do a
> FreeMarker [#list] loop to render your nodes. There was a reason, which I
> can't recall, for which we didn't do this in stk (something to do with
> rendering state, I think - and that might not apply to more recent versions
> of Magnolia) but it might not apply to your case, depending on what you do
> with those nodes you're iterating on.
>
> hth,
>
> -g
>
> On 28 Feb 2011, at 07:34, Will Scheidegger wrote:
>
>> Thanks for the help, Grégory. Unfortunately I have not gotten in working so
>> far.
>>
>> This is the my template with the ContentNodeIterator:
>> ...
>> [@cms.contentNodeIterator items=metaNavigation.content?children
>> varStatus="status"]
>> [#assign fmStatus = status /]
>> ...
>> As you can see I tried both setting the regular "JSP" variable ("status")
>> and assigning a Freemarker variable ("fmStatus").
>>
>> This is my included template (with [@cms.includeTemplate /]:
>> ${status!'no \"status\" defined'}<br />
>> ${fmStatus!'no \"fmStatus\" defined'}<br />
>> ${ctx.status!'no \"ctx.status\" defined'}<br />
>> ${ctx.fmStatus!'no \"ctx.fmStatus\" defined'}<br />
>>
>> Unfortunately non of the values are defined in the included template. So any
>> other ideas of things I could test are very much appreciated.
>>
>> Thanks!
>> -will
>>
>> On 25.02.2011, at 17:42, Grégory Joseph wrote:
>>
>>>
>>> On the top of my head, ${ctx.status} might work. If not, I'll do some
>>> research, cause that was one of the stumbling blocks when we began
>>> integrating FreeMarker, and I'm sure I got it working at some point.
>>>
>>> -g
>>>
>>> On 25 Feb 2011, at 15:36, Will Scheidegger wrote:
>>>
>>>> Dear Magnolians
>>>>
>>>> Lately I'm asking much more questions than I'm answering -> my reputation
>>>> is going down the drain! Oh well, what can I do? I cannot afford to spend
>>>> hours of research on every small problem. So here's the next question:
>>>>
>>>>
>>>> I have a (JSP tag) ContentNodeIterator in a freemarker template which sets
>>>> the status variable:
>>>>
>>>> [@cms.contentNodeIterator items=metaNavigation.content?children
>>>> varStatus="status"]
>>>> ...
>>>> [/@cms.contentNodeIterator]
>>>>
>>>> Now I can easily access the status variable in this template (using
>>>> ${status...}). But how can I use it in the subtemplate (i.e. the one that
>>>> will be included with [@cms.includeTemplate]? With JSP I could set the
>>>> variable in the request scope (or I think the ContentNodeIterator did that
>>>> automatically). But how do I do it with Freemarker? Or actually: How is it
>>>> done so it will work with Freemarker AND JSP paragraph tempaltes?
>>>>
>>>> Thanks!
>>>> -will
>>>>
>>>>
>>>>
>>>> ----------------------------------------------------------------
>>>> For list details see
>>>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>>>> To unsubscribe, E-mail to: <[email protected]>
>>>> ----------------------------------------------------------------
>>>
>>>
>>>
>>> ----------------------------------------------------------------
>>> For list details see
>>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>>> To unsubscribe, E-mail to: <[email protected]>
>>> ----------------------------------------------------------------
>>>
>>
>>
>>
>> ----------------------------------------------------------------
>> For list details see
>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>> To unsubscribe, E-mail to: <[email protected]>
>> ----------------------------------------------------------------
>
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
>
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------