@strip_tags & nl2br plugin

Discussion corner for Developers of Serendipity.
Post Reply
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

@strip_tags & nl2br plugin

Post by Don Chambers »

Here is my entry body created using the html editor:

<strong>Paragraph 1</strong>

<i>Paragraph 2</i>

<p>Paragraph 4</p>

1) I have am using the nl2br plugin, expecting it to insert <br />'s after each sentence and blank line above.
2) I need to strip all possible tags from the entry body.
3) I strip the entry body as follows: {$entry.body|@strip_tags|@strip}

Turns out this strip tags code actually removed the effects of the nl2br plugin. How can I strip the actual entry body tags without removing the markup added by the nl2br plugin?
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: @strip_tags & nl2br plugin

Post by garvinhicking »

Hi!

Try {$entry.body|@strip_tags:'br'} instead. This allows to leave <br> intact.

Or disable the nl2br plugin and use {$entry.body|@strip_tags|@strip:'<br />'} or {$entry.body|@strip_tags|nl2br}.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply