Are you saying that "myfield" is some HTML text stored in a database, and 
you want to insert the HTML in a view? Note, by default, web2py escapes all 
content written to views -- this is a security measure to prevent malicious 
code from running. You can prevent the escaping by wrapping in the XML() 
helper:

{{=XML(myfield)}}

Note, this can be dangerous, so don't do it if myfield contains 
user-entered content. You can minimize the risk by sanitizing:

{{=XML(myfield, sanitize=True)}}

though that limits the type of content that can be included.

See http://web2py.com/books/default/chapter/29/05#XML.

Anthony

On Thursday, April 11, 2013 8:40:50 AM UTC-4, Serge Bourgeois wrote:
>
>
> My question is certainly trivial, but I cannot find any answer on the 
> web...
>
> I try to display a field (let's say myfield)containing html tags in viewer 
> using {{=myfield}}.
>
> Example of content: 
>
> <body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; 
> font-style:normal;">
> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; 
> margin-right:0px; -qt-block-indent:0; text-indent:0px;">...blablabla (this 
> is my business data)... </p></body>
>  
> My problem: what I get displayed is the whole field content, including the 
> tags.
> I would like the tags to be 'captured and understood' by the web browser 
> and not included as part of my business data.
>
> Thanks in advance for any suggestion.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to