Hello Anthony,

I am trying to do something bizzard... I would like to have your advice if
it's even possible :

represent=lambda value, row: (value!=None and XML(UL(*[ LI(v) for v in
value.split('/') if v != '' ]))) or 'None'

I would like the default navigator drop box to display html stuff is this
possible?

Thanks

Richard

On Thu, Nov 10, 2011 at 8:07 AM, Anthony <[email protected]> wrote:

> On Thursday, November 10, 2011 7:58:57 AM UTC-5, peter wrote:
>>
>> I have a couple of problems with 'text' fields in databases. I want to
>> be able to use a WYSIWIG editor, so I have set up ckeditor using the
>> instructions here
>>
>> http://www.web2pyslices.com/**slices/take_slice/18<http://www.web2pyslices.com/slices/take_slice/18>
>>
>> This works fine, but there is no toolbar appearing with the editor.
>> How does one get the basic toolbar to appear?
>>
>
> You have to set the CKEditor options -- see it's documentation:
> http://ckeditor.com/
>
>
>>
>> If I succeed in getting this working and can embolden text etc. How do
>> I convert the text to html that reflects this emboldening?
>>
>
> You won't be converting text to HTML -- CKEditor itself generates HTML,
> which is what will get saved in the associated text field in the DB. The
> trick is how to get the HTML to display properly when you pull it from the
> DB and include it in the view. By default, web2py will escape the HTML, so
> it won't display as intended. To avoid that, use the XML() helper -- in the
> view, {{=XML(your_html_content)}}. Though this is dangerous if you are
> allowing users to enter the HTML because they can insert malicious
> Javascript. In that case, use {{=XML(your_html_content, sanitize=True)}},
> though that will limit the allowed HTML tags and attributes. See
> http://web2py.com/book/default/chapter/05#XML.
>
> Anthony
>

Reply via email to