Jump to content

How Do I Force A Linebreak?


Shakazahn
 Share

Recommended Posts

I've made a comment box for my site and someone spammed a reaaaallllyyyy long line, and the comment box "broke".I'm using the sliding doors tech, with a 1600w long pic, but what's annoying is that no matter if I set a fixed width or not on FF the comment will just go out of the box (but the box will remain at max-width set) while on IE it'll break no matter what width/max-width I set.Is there a PHP command to force a linebreak from a SQL data?Quick Edit: I'm not asking about \n, but something that would help me prevent comments like that from "breaking" the box and messing the site's layoutQuick Edit2: Found, after some hours (and just after I gave up and resorted to the forums :)) the wordwrap($string, $maxchars) command.

Edited by Shakazahn
Link to comment
Share on other sites

You can use the wordwrap() function on the information extracted from the database. It will add a line break to a string at a defined amount of characters.There are other ways to do it, like regular expressions or algorithms using strlen() or many other things.

Edited by Ingolme
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...