Re: Formatting Question

From: Date: Mon, 02 Oct 2006 21:13:11 +0000
Subject: Re: Formatting Question
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-242496@lists.php.net to get a copy of this message
At 3:51 PM -0500 10/2/06, Richard Lynch wrote:
Don't "pollute" your raw data (the newlines) with a very media-specific formatting code ("<br />") -- Keep your raw data pure and clean, and format for the destination when you send it there, not when you store it. There *might* be some egregious examples of over-loaded high-volume servers where adding the "<br />" at run-time is "too much work" -- At that point, it's probably still not the "Right Answer" to pollute the raw data. It might be expensive, but adding a cache of the output data, or even a second field for data_as_html to the database should be considered. Anything other than polluting your raw data. This may seem high-falutin' purism, but it will make your life sooooo much more pleasant some day down the road.
Richard: You are absolutely right of course -- don't pollute your raw data. Why not use nl2br() to show the data in the browser and leave the data "as-is" in the dB? tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#242496) next »