开发者

Remove trailing tags from a HTML textfield in PHP and/or TinyMCE

I have a problem: I am using TinyMCE for a text field. It all works fine until a user hits the enter button some times at the end of h开发者_开发技巧is input (new lines that are not needed). So for some inputs I save

<p>CONTENT</p><p> </p><p> </p>

or

<p>CONTENT</p><br /><br />

Since this input is displayed at other places of the webpage in a certain design, the trailing empty paragraphs and breaklines can trash the layout.

So I am looking for a way to check wheter these empty tags exists at the end of a string in PHP to remove them (for previously created entries) and if possible, I would like to configure TinyMCE to not allow such tags at all (not as important as the PHP solution).

Does anyone have an idea on how to do that? I can find/replace all empty paragraphs but this is too hard since users are using them to create gaps between their inputs. I really just want to find the trailing ones.


(<p> </p>|<br />)+$
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜