![]() |
Help with commas in RealChat rooms string
Could anyone please help me add commas to the string of RealChat rooms that the following code generates?
PHP Code:
Quote:
The Bear's Den The Lobby Fun Staff only! No topic Bear's Den I would like commas after the names except for the last one. This is the code that came with it so I have no idea how to add the commas. Thanks in advance. ;) |
Assuming that each channel is being retrieved on its own line, you should be able to:
PHP Code:
|
Quote:
Quote:
And thank you, very much, sir. ;) |
Replace:
PHP Code:
PHP Code:
|
Excellent! Worked like a charm! Thank you, sir. ;)
|
you could also use the php trim() function. It removes all surrounding whitespace characters, which is very helpful when dealing with strings.
|
Quote:
|
Instead of doing:
PHP Code:
PHP Code:
|
Quote:
For future reference, will the trim get rid of whitespace on both sides of the line or just the preceding whitespace? |
I am getting a comma after the amount of users in the chat room randonly now. It doesn't happen all the time but every once in a while. Like this:
Quote:
|
Is that output from the function above? If not, post that code, and I'll take a look at it.
Do refer to the substr function above for truncating strings. A how-to-use reference for it is here: http://www.php.net/substr Also, trim: http://www.php.net/trim |
Quote:
That is from this: $userCount = getServerAPI( "api.UserCount" ); in my first post at the bottom of the code. It's all part of the same code. The wierd thing is it doesn't do it all of the time. Only about every 5th time or so. Sometimes more, sometimes less. |
I used these tips as a guideline for my RealChat implementation. I sure appreciate this post. I have a question though, whenever my rooms are empty this is what is diplayed.
ERROR: Room empty. ERROR: Room empty. Any ideas. |
All times are GMT. The time now is 11:36 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|