Forum OpenACS Q&A: Re: Instructions on how to make your package support HTMLArea

Jose,

I guess if this happened because you switched to HTMLArea you should write a little SQL query that replaces old entries "xyz" with {xyz} {content-type}. The problem is that you don't  know necessarily the content type of that content, right?

Maybe [ad_looks_like_html_p $content] would help. Or you use [util_remove_html_tags $content] and if the result is smaller than what came from database then it is HTML.

You can also leave the content as it is in the database and use the following to distinguish. This is what I do for static-portlet:

set success_p [db_0or1row select_content {
  select body as content, pretty_name
  from static_portal_content
  where content_id = :content_id
}]

set size [llength $content]
if { $size == 2} {
    set content [lindex $content [expr [llength $content]-2]]
}

So if it is a list with two elements I assume that it is richtext and I only take the first element with the actual content.

In the ADP I then simply use:

@content;noquote@

Regarding the interpretation of HTML we have several procs to handle that:

ad_convert_to_html text
ad_html_to_text html
ad_text_to_html text
util_convert_line_breaks_to_html text
util_remove_html_tags html
ad_html_security_check html
...

Greetings,
Nima