ShoutBox 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

User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

ShoutBox problem!

Post by William »

Hello,
I am having this problem where if you type in AAAAAAAAAAAAAAAAAAAAAAAAAAAA or somthing it overrides the table and makes it wider. Im designing a ShoutBox http://www.thenetherrealm.com/shoutbox.php And I need it so when somone sites there and typs in AAAAAAAAAAAAAAAAAAAAAA it wont make that scroll bar go left or right it auotmaticly does a line break, And ideas? There is probley a way where it coutns the chaectors and foreach() fuction ot add <br /> .ect But is there a fuction?
User avatar
Sevengraff
Forum Contributor
Posts: 232
Joined: Thu Apr 25, 2002 9:34 pm
Location: California USA
Contact:

Post by Sevengraff »

you mean like wordwrap()
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

Thank's, :-)
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

It's not working :-(

Code: Select all

// Automaticly break long lines.
$shout_data1 = wordwrap($shout_data1, 5, "<br />");
$shout_data2 = wordwrap($shout_data2, 5, "<br />");
$shout_data1 is there name
$shout_data2 is there message.
It's not changig my WWWWWWWWWWWWWWWW to WWWW
WWWW
WWWW
Or how ever it is saposed to do it :-(
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

Code: Select all

// Automaticly break long lines.
$shout_data1 = wordwrap($shout_data1, 5, "<br />",1);
$shout_data2 = wordwrap($shout_data2, 5, "<br />",1);
try that
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

Let me try and what's the 1 for?
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

IT WORKS! Thank's so much :-P
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

Doesn't work really good... because it cuts them off to shourt... And if I make it really big it let's people put WWWWWWWWWWWWWWWWWWWWWW in why can't it just stop them why does it have to grow grrr
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

the 1 tells it even if its one long wooooooooord with no spaces to break it up too!
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

if it cuts them off too short them change that 5 to something larger, like a 10 or something!
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

O ok, Any ideas so I can make it be able to put Hi how are you and let it all fit that instead of How
Are
You

and if I make it bigger then WWWWWWWWWWWWW messes it up grr
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

Code: Select all

$shout_data1 = wordwrap($shout_data1, 5, "<br />",1);
instead of that 5, change it to like 15,

Code: Select all

$shout_data1 = wordwrap($shout_data1, 15, "<br />",1);
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

What do you mean by messes up?
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

Well right now you tpye in a sentance t only allows 2 words.. But if you type in WWWWWWWWWWWWWWWWWW it doubles the hole box then breaks... Al I want it to do is be like it was type osmthing it ti auotmaticlty breaks liek it's sapsoed to but... When you type in WWWWWWW or somthing it keeps oging thats what I want to break when they sit there and hold down somthing or they jsut dont use any spaces Understand?
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

are you sure your using the wordwrap() function?? because its working on my computer....
Post Reply