Re: [xwiki-users] Showing HTML in a page from a field

2010-01-16 Thread Jeremie BOUSQUET
Thanks for explaination ! It will be useful to me to know this difference
now... And explains some issues I had ! ;)
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Showing HTML in a page from a field

2010-01-16 Thread Flavius Olaru
Jeremie,

The first method uses Object.display() while the other
Object.getProperty().value retrieves the value without rendering.

On Fri, Jan 15, 2010 at 6:37 PM, Jeremie BOUSQUET
 wrote:
> Wow, super thanks Marius, it works perfectly !
> I'm not sure to understand why, but it did the trick :)
>
> Jeremie
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>

-- 
Flavius Olaru
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Showing HTML in a page from a field

2010-01-15 Thread Jeremie BOUSQUET
Wow, super thanks Marius, it works perfectly !
I'm not sure to understand why, but it did the trick :)

Jeremie
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Showing HTML in a page from a field

2010-01-15 Thread Marius Dumitru Florea
Hi Jeremie,

Jeremie BOUSQUET wrote:
> Hi all,
> 
> This problem is driving me nuts...
> I try to retrieve some HTML content from a field of a specific object, and
> display it in a page (rendered, not as code).
> 
> I wrote this kind of code, and it's the unique content of my page :
> 
> {{velocity filter="none"}}
> {{html clean="false" wiki="false"}}
> #set ($obj = $doc.getObject("MyClass"))

> #set ($htmlbody = $obj.bodyhtml)
> #set ($htmlbody = $htmlbody.replaceAll(" ", "
> ").replaceAll("<","<").replaceAll(">",">").replaceAll("","").replaceAll("&",
> "&").replaceAll(""", '"'))

What happens if you replace the 2 lines above with:

#set($htmlbody = $obj.getProperty("bodyhtml").value)

Hope this helps,
Marius

> 
> $htmlbody
> 
> {{/html}}
> {{/velocity}}
> 
> The replacements are here because, for any reason, I could not manage to
> store my HTML in the field without having many characters substituted in the
> process (like "<" and such), and line break tags are inserted randomly, but
> the resulting string looks like regular HTML content (I debugged it in
> server logs).
> 
> Problem is that, when rendered, this page shows the following :
> 
> {{html clean="false" wiki="false"}}
> [... html content rendered ...]
> 
> So there are 2 problems IMO, and I really don't see from where they come :
> - my {{html}} macro is not understood by the wiki engine
> - even if not understood, the page understands the $htmlbody is html and
> renders it like that. But it assumes wiki="true", and so, for example, all
> links are broken (replaced by bunches of " result is not clean
> 
> Thanks,
> Jeremie
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] Showing HTML in a page from a field

2010-01-15 Thread Jeremie BOUSQUET
Hi all,

This problem is driving me nuts...
I try to retrieve some HTML content from a field of a specific object, and
display it in a page (rendered, not as code).

I wrote this kind of code, and it's the unique content of my page :

{{velocity filter="none"}}
{{html clean="false" wiki="false"}}
#set ($obj = $doc.getObject("MyClass"))
#set ($htmlbody = $obj.bodyhtml)
#set ($htmlbody = $htmlbody.replaceAll(" ", "
").replaceAll("<","<").replaceAll(">",">").replaceAll("","").replaceAll("&",
"&").replaceAll(""", '"'))

$htmlbody

{{/html}}
{{/velocity}}

The replacements are here because, for any reason, I could not manage to
store my HTML in the field without having many characters substituted in the
process (like "<" and such), and line break tags are inserted randomly, but
the resulting string looks like regular HTML content (I debugged it in
server logs).

Problem is that, when rendered, this page shows the following :

{{html clean="false" wiki="false"}}
[... html content rendered ...]

So there are 2 problems IMO, and I really don't see from where they come :
- my {{html}} macro is not understood by the wiki engine
- even if not understood, the page understands the $htmlbody is html and
renders it like that. But it assumes wiki="true", and so, for example, all
links are broken (replaced by bunches of "http://lists.xwiki.org/mailman/listinfo/users