setting html rule endings back to normal endings

  • Inito
  • Graduate
  • Graduate
  • User avatar
  • Posts: 223

Post 3+ Months Ago

im using
Code: [ Select ]
$news['news_main'] = eregi_replace('<br[[:space:]]*/?[[:space:]]*>', "\n", $news_['news_main']);

for replacing the <br /> back to normal endings.
But if I use that, nothing appears. Maybe it replaces everything with rule endings, resulting in a blank field?

If I dont use it, normal rule endings do appear, but in a manner like

Code: [ Select ]
rule 1<br />
rule 2<br />
rule 3
  1. rule 1<br />
  2. rule 2<br />
  3. rule 3
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

nl2br doesn't actually remove the newlines it just puts a <br /> before them, so all you want to do is remove them rather than replace them:

You could try something like:

Code: [ Select ]
$article = str_replace ("<br />", "", $news_['news_main']);
  • Inito
  • Graduate
  • Graduate
  • User avatar
  • Posts: 223

Post 3+ Months Ago

thanks, but that doesnt display the message either. I know, its weird.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 110 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.