Quick and Easy Product Description Line Break Solution

WebsHawaii <[email protected]> 12 Sep 2003 05:14:48 -0000
Newsgroups gmane.comp.web.oscommerce.installation
Message-ID <82c12549319641a0fc75a68a5bad4ec3@osCommerce-Forums>
This message was sent from: Installation and Configuration
http://forums.oscommerce.com/viewtopic.php?p=228258#228258
----------------------------------------------------------------

Here is what I did in regards to the line break issue.

The issue that I had was in regards to how product_info.php displayed the description of the item.  I would not display any of the line breaks.  The suggestions that I have received were install the WYSIWYG contribution but I have made to many mods to the store so that will not work and its to time consuming to install.

Here is the solution that I came up with.

I created a function that converts \n to a <BR> tag.

   <?php
function nl2p($text) { 
   $text = ereg_replace("\n", "<br>", $text); 
   return $text; 

 } 

?>


and inserted that at about line 115 just above this call

($product_info_values['products_description'

 I then added nlp2 just before it so the desc now looks like this

 <?php echo nl2p ($product_info_values['products_description']); ?>


Works like a charm and I thought that I'd pass it along.

--Gary