Quick and Easy Product Description Line Break Solution
WebsHawaii <[email protected]> 12 Sep 2003 06:05:57 -0000
| Newsgroups | gmane.comp.web.oscommerce.tips |
|---|---|
| Message-ID | <2018b0d69012cd350024c71880a8a9c9@osCommerce-Forums> |
This message was sent from: Tips and Tricks
http://forums.oscommerce.com/viewtopic.php?p=228264#228264
----------------------------------------------------------------
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