Wall of text instead of line breaks?

I am working on a project using OS COmmerce. The problem I am having is my item descriptions are displaying as a big block of text. Take a peek… http://chicagogunsmith.com/catalog/xenon-flashlight-bezel-p-16164.html The text displays as:

The MX Modular Flashlight offers four unique single and multi-mode Bezels with the latest Xenon or True White LEDs. Combine any of the Bezels with a Maintube and Tail Switch to create a flashlight uniquely suited to your illumination needs. From the simple to the complex, the MX modular system delivers the flexible illumination you demand, whether you hunt, fish, camp, hike, or work in any type of public safety profession. Features: The Xenon lamp in the MX-100 Bezel produces a bright, focused beam with either 85 or 145 lumens of output depending on Maintube selection. - 85 Lumens of output (with MX-020 Maintube) for a startlingly bright beam. - 145 Lumens of output (with MX-030 Maintube*) for a startlingly bright beam. - Single mode, Xenon bulb is the ultimate in performance. - Precision reflector maximizes brightness while tightly focusing the beam. - 1.5 Hours of runtime with the MX-020 or MX-030. - Durable, scratch-resistant sapphire window, made from one of the hardest man-made substances on Earth. - Part of our totally modular MX system, you can pair the MX-100 with any of our Maintubes and Tail Switch to create your perfect flashlight. - Incredibly rugged construction to withstand hard use in the field. - Absolute Waterproof Integrity to four atmospheres. Leupold pioneered the waterproofing technology that’s now the industry standard in riflescopes worldwide. - Accepts 28mm Alumina accessories, allowing you to customize your flashlight’s performance to match changing conditions of light and weather. * Xenon Bulb Replacement Assembly Required – To ensure your MX-100 Xenon Bezel performs properly when assembled with a MX-030 3-Cell Maintube, you will need to purchase separately a 9-volt Xenon Bulb Replacement Assembly to replace the standard 6-volt bulb. No additional parts are needed for the MX-100 Bezel and the MX-020 (2-Cell Maintube) combination. Specifications: - Weight 3.2 oz - Length 2.0" - Diameter 1.37" - Mode(s) Lumens – Runtime - Single Mode 85 / 145 – 1.5 hours

But should display as:

"The MX Modular Flashlight offers four unique single and multi-mode Bezels with the latest Xenon or True White LEDs. Combine any of the Bezels with a Maintube and Tail Switch to create a flashlight uniquely suited to your illumination needs. From the simple to the complex, the MX modular system delivers the flexible illumination you demand, whether you hunt, fish, camp, hike, or work in any type of public safety profession.

Features:

The Xenon lamp in the MX-100 Bezel produces a bright, focused beam with either 85 or 145 lumens of output depending on Maintube selection.

  • 85 Lumens of output (with MX-020 Maintube) for a startlingly bright beam.
  • 145 Lumens of output (with MX-030 Maintube*) for a startlingly bright beam.
  • Single mode, Xenon bulb is the ultimate in performance.
  • Precision reflector maximizes brightness while tightly focusing the beam.
  • 1.5 Hours of runtime with the MX-020 or MX-030.
  • Durable, scratch-resistant sapphire window, made from one of the hardest man-made substances on Earth.
  • Part of our totally modular MX system, you can pair the MX-100 with any of our Maintubes and Tail Switch to create your perfect flashlight.
  • Incredibly rugged construction to withstand hard use in the field.
  • Absolute Waterproof Integrity to four atmospheres. Leupold pioneered the waterproofing technology that’s now the industry standard in riflescopes worldwide.
  • Accepts 28mm Alumina accessories, allowing you to customize your flashlight’s performance to match changing conditions of light and weather.
  • Xenon Bulb Replacement Assembly Required – To ensure your MX-100 Xenon Bezel performs properly when assembled with a MX-030 3-Cell Maintube, you will need to purchase separately a 9-volt Xenon Bulb Replacement Assembly to replace the standard 6-volt bulb. No additional parts are needed for the MX-100 Bezel and the MX-020 (2-Cell Maintube) combination.

Specifications:

  • Weight 3.2 oz
  • Length 2.0""
  • Diameter 1.37""
  • Mode(s) Lumens – Runtime
  • Single Mode 85 / 145 – 1.5 hours"

For the record, I am uploading using EZ Populate. The reason I am not posting in the EZ Pop support thread is because I beleive it is a setting in the way PHP is calling and displaying the text. In my spreadsheet the format is correct, if I check my databse using PHPMyAdmin the format is correct, however when viewed with the OS Commerce, the display is a big block of text with no formatting or breaks.

I know the answer is simple. I had a similiar problem in the past with a php/mysql project I was working on and I just can’t recall the one line of code I had to add to fix it. Please help.

I should note the problem is occuring for all items, and the item refrenced above was done so only as an example. Take a look around at any other item.

I can provide code if necessary, I just remmeber last time I had this problem with another php/mysql project it was a very simple fix but I can’t remember what it was.

Line breaks in HTML do not become line breaks when you view the page. You have to explicitly write <br> tags. Use nl2br.

HTML seems like a simple answer, but HTML is not an option due to the vast number of items that will need to be updated approximately monthly.

I think that nl2br is what I used previously. I’ll play around with it and see if it works. Now that I know the code I can do a search of my webpages and see if it is what I used and how I made it work.

Thanks!

HTML is not an option

you’re probably don’t understand what the web browser is and what is it were invented for :slight_smile:

I was not suggesting you start using HTML when writing the product descriptions.

But what osCommerce produces, and what the browser renders, is HTML. All webpages are HTML. And in HTML syntax when you want a line break to appear, you have to type <br>, not just press the enter key. nl2br() will transform the line breaks in the text from your database to <br> tags.

Ok got it, after some hunting I found the code that showed as

<?php echo stripslashes($product_info['products_description']); ?>

and replaced the stripslashes with nl2br and now all is good. I checked out numerous items and all appear to be working out as intended.

I knew it could be done! Thanks again.

Dan I do not write the product descriptions. I import approxaimtely 6000 items via my vendor’s database on spreadsheet. They make changes to their database to include new items, remove out of stock items, etc etc… and to go through 6,000 items once a month and add <br>, well that’d be probably 50,000 <br>'s added monthly.

FYI, I knew what you were trying to tell me. Sorry if it came off otherwise. Actually your advice was exactly what I was looking for.

Again, I was never suggesting you add <br> tags to your descriptions. I was explaining why you need to use nl2br when you display them.

Maybe you should have left stripslashes there and just wrap nl2br around it.