Unusual text wrapping problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
AnotherAlex
Forum Newbie
Posts: 2
Joined: Fri Aug 01, 2008 2:54 pm

Unusual text wrapping problem

Post by AnotherAlex »

Hello everyone!

I whave a following problem: when trying to wrap a text with tags, a function sometimes places <br /> inside a tag, like this: "<a<br /> href...."

How can I avoid it? I've searched the forums for "wrap text tags" keywords, but found no similar topics.

Thank you!
nowaydown1
Forum Contributor
Posts: 169
Joined: Sun Apr 27, 2008 1:22 am

Re: Unusual text wrapping problem

Post by nowaydown1 »

I would take a look at the wordwrap docs on php.net. Looks like there's a few guys on there who have posted workarounds for the problem you describe: http://us.php.net/wordwrap
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: Unusual text wrapping problem

Post by omniuni »

A little more info would be great, but you could try striptags() on it, and allow "a" but not "br". That should give you clean links, without br's in them.
AnotherAlex
Forum Newbie
Posts: 2
Joined: Fri Aug 01, 2008 2:54 pm

Re: Unusual text wrapping problem

Post by AnotherAlex »

Thank you! I will definitely have a look at php.net discussion.
Post Reply