PDA

View Full Version : Shoutbox Linebreak (<br>) removal?


Aaron1
08-21-2003, 07:59 AM
It would be very handy if the shoutbox doesn't support or automatically removes linebreaks, just to prevent the shout get's enormous 'heights' on the forum home page.

Is this possible to do that with javascript or through PHP?

I have already set a maximum number of characters in the shoutbox. But that doesn't prevent people from doing something like this:

Hey
this
shoutbox
is
very
cool
thanks
for
that!

This type of shout really messes up my forumhome page...

Someone knows how to do that?
Thanks!

Aaron

Aaron1
08-22-2003, 08:54 AM
i did some investigation myself, and I think I found the right script for this, but i don't know how to combine it with the Shoutbox.php...

http://groups.google.com/groups?hl=nl&lr=&ie=UTF-8&oe=UTF-8&threadm=2633f1b6.0210101855.12a3b1ca%40posting.goo gle.com&rnum=1&prev=/groups%3Fq%3Dphp%2Bremove%2Bbreaks%26hl%3Dnl%26lr% 3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D2633f1b6.0210101855.12a3b1ca%2540postin g.google.com%26rnum%3D1

This is the script that should work:

$foo = "This is
a string with
line breaks";

echo $string;

$bar = preg_replace ("/(\r?\n)/", "", $foo);

echo "\n\n";
echo $bar;

But how do i combine this with the shoutbox script:

$shout_text = bbcodeparse($shout_text);

Do i need to make a substring?
If someone is experienced with php, please give me a hand...

pie
08-22-2003, 11:52 AM
try sticking this before that code

$shout_text = preg_replace ("/(\r?\n)/", "", $shout_text);

Aaron1
08-22-2003, 11:56 AM
Cool!
That works thanks alot!