List:General Discussion« Previous MessageNext Message »
From:Steve Edberg Date:August 18 2004 5:59pm
Subject:Re: html in a text field - good practice?
View as plain text  
At 08:37 AM 8/18/04, leegold wrote:
>Question I have wondered about: Is it a good practice to put html in a
>text field, then (eg. via php) when the marked-up text renders in a
>user's browser it's good looking html. If not, then I'd just sandwitch
>field content in a <p></p> when it's rendered. Though, seems like it
>would mess-up fulltext searching in a marked-up text field(?). Thanks.
>Lee G.

I'd say that in general, it's best  to avoid storing markup with text, 
because (1) as you say, it could mess up fulltext search statistics, and 
(2) it makes it more complex to repurpose that data - eg; export it to PDF 
instead of HTML. It's best to keep rendering separate from content.

If you *need* to store formatting information, you might be better off 
saving it in a more general format like XML or even SGML. If you had to do 
a lot of that, and search it, you might be better off using an XML 
database, though. I suppose that you could twiddle with MySQL's fulltext 
search parameters (min. word length, stop words, etc) to get it to ignore 
embedded HTML/XML/SGML, though.

         steve


+------------------------------------------------------------------------+
| Steve Edberg                                      sbedberg@stripped |
| Database/Programming/SysAdmin                            (530)754-9127 |
| University of California, Davis             http://pgfsun.ucdavis.edu/ |
+---------------------- Gort, Klaatu barada nikto! ----------------------+

Thread
Problem with Mysql 4.1.3: Error #1267 - Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)Martin Rytz18 Aug
  • RE: Problem with Mysql 4.1.3: Error #1267 - Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)Donny Simonton18 Aug
  • html in a text field - good practice?leegold18 Aug
    • Re: html in a text field - good practice?Steve Edberg18 Aug
      • Re: html in a text field - good practice?Parker Morse19 Aug
    • Re: html in a text field - good practice?Josh Trutwin18 Aug
      • Select statement escaping characters questionleegold23 Aug
        • Re: Select statement escaping characters questionMichael Stassen23 Aug