0

I am retrieving data and print it as paragraph. I am facing a problem that paragraph width is default by system. I want to break the line (like br property). I have used css property 'break all' but it is not working in some version of mozila. I have used fixed width and many html css property, but in old version of mozila it is not running well. May you tell me how can we this problem in java script or php. I am zonked.

  • 2
    http://stackoverflow.com/questions/11810270/how-to-split-up-a-string-after-a-certain-number-of-characters-in-php... try this – rOcKiNg RhO Nov 20 '12 at 04:35

2 Answers2

1

Calculate length of data which you want to print.

You can calculate length of data using following code:

 strlen($data);

Suppose length of data is 200. You want break each line after 100 character try following code:

<?php
 echo substr($data,0,100);echo"<br>";
 echo substr($data,101,200);
 ?>

Hope it will useful for you

0

If you want to break the line at a specific maximum character count then I'm sure you can achieve that code. Breaking a line on word counts typically becomes a lot more complicated when you have to do it in your own code, as there are many exceptions such as already hyphenated words (break at hyphen) or phrases that shouldn't be broken across lines. Some very long words should be hyphenated by the code and broken on the hyphen. This then becomes a typesetting problem instead of a simple script, if you want to do a good job. Otherwise persist with css and html tags to get the job done in a consistent manner that doesn't involve hard work. I guess if you post your current html and css and let us know what version of mozilla, we could try to help. I'm sure there's javascript or php line break code out there if you look for it. It'll do what it does and it'll be up to you to decide on all those special case parameters to make your output look good.

chris
  • 412
  • 6
  • 13