hi guys
I solved it, and it was a strange set of circumstances. The problem I
had was actually a freemarker problem
I was using the following code to add a class with some functions to
the context:
TemplateHashModel staticModels = wrapper.getStaticModels();
try {
for (String name : classesToInclude.keySet()) { TemplateHashModel
model = (TemplateHashModel)
staticModels.get(classesToInclude.get(name)); map.put(name, model); }
} catch (TemplateModelException e) { e.printStackTrace(); }
Then I tried to do stuff like ${content.getClass()) or
${content.class} in the template, and somehow that doesn't work.
So I created a simple function in my support class that accepted an
Object instance and returned the class name.
Then it turns out that if you use the staticModel approach for adding
classes, something goes wrong in the freemarker reflection stuff and
somewhere the object changed into a string (using toString()).
So that was it.
My bad, but thanks for the reply.
regards,
Ernst
2010/2/10 Grégory Joseph <[email protected]>:
>
> Ernst, if you're curious, the magic happens in
> info.magnolia.freemarker.models.MagnoliaObjectWrapper and
> info.magnolia.freemarker.models.ContentModel :)
>
> Cheers,
>
> -g
>
> On Feb 10, 2010, at 10:35 AM, Christian Ringele wrote:
>
>> Hi Ernst,
>>
>> I'm not sure, how you tried to access the content node.
>> Here an example how you access the content node itself (which is a node of
>> the page).
>> I added this to the main.ftl:
>> <div id="main">
>> <h1>NAME: ${conte...@name!}</h1>
>> <h1>TITLE: ${content.title!}</h1>
>> <h1>"CONTENT STRING...": ${content}</h1>
>>
>> I guess the third line is what you tried.
>> As you can see on the print screen, it returns the content node name when
>> calling just ${content}.
>> I hope this answers your question.
>>
>> <Screen shot 2010-02-10 at 10.26.13 AM.png>
>>
>> Cheers,
>> Christian
>>
>>
>>
>> On Feb 4, 2010, at 9:55 AM, Ernst Bunders wrote:
>>
>>>
>>> hello
>>>
>>> I'm a bit puzzled: the content variable in the main.ftl template holds
>>> a string, and not a reference to the page content node. I don't get
>>> this.
>>> Can anybody explain this please?
>>>
>>> regards,
>>>
>>> --
>>> Ernst Bunders
>>> Ontwikkelaar VPRO
>>>
>>> ----------------------------------------------------------------
>>> For list details see
>>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>>> To unsubscribe, E-mail to: <[email protected]>
>>> ----------------------------------------------------------------
>>
>> Best regards,
>>
>> Christian Ringele
>> Magnolia International Ltd.
>>
>> Magnolia® - Simple Open Source Content Management
>>
>>
>>
>> ----------------------------------------------------------------
>> 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]>
> ----------------------------------------------------------------
>
>
--
Ernst Bunders
Ontwikkelaar VPRO
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------