Introducing: The ShoutBox! (Including Parts II & III)
by The Architect
(783 views) - 1/7/04
(recorded 1/7/04 @ 5:55:53 AM)
EDIT: Please visit THIS ENTRY for information about the new ShoutRoom. That is all. (1/15/04)

ShoutBox whatnow? Yes, if you look to your left, you'll see a neat little new feature known as the "ShoutBox". Other names they go by include "Tag Boxes", "Chatterboxes", "Catboxes", and the like...

What is it?
Simply, just a place for you to drop your two cents. You have to be logged in, and it will always show the last five or so posts made. This may become "the last five posts made within the last few days", but I doubt it.

What about older stuff?
I'll probably come up with a page that dumps past "shouts" so you can browse through old stuff. They're all saved, it's just only displaying the past 5 or so.

What about my stuff?
I'll make it a feature to be able to see all the shouts you've said, from the control panel or some such.

Other features?
I'd *love* to incorporate actions using /me and allowing users to private message each other through the system... The first part of that little dream is actually relatively easy. Edit: See below. The second part, not as much- I need a system that allows people to archive old messages to them, see old messages to them, and all that fun stuff.

Also, I'd love to throw it into an inline frame that updates itself every so often. Tell me which of these features you'd like the most.

HTML isn't allowed yet, but that's a possibility, at least in moderation (used for emphasis and the like, of course).

So, you came up with this on your own?
God no. Thanks, Everything2 for the first implementation I've seen of this- another is on a Quake server site I frequent. I built it from the ground up, like everything else on here though. But the idea was *not* mine.

*The Architect rocks the actions hardcore, too
But seriously, type '/me does something' and it'll be interpreted as '*The Architect does something'. This is from IRC, which allows for actions. TNG Sims represent!

Anything else?
The header file (which builds the navigation system) was *horribly* coded, duplicating the primary code, and adding links for when you were logged in. I changed this approach drastically, which took about an hour and a half, including all the time to build the ShoutBox system.

I hope you guys will use and enjoy it... I'll have auto-link parsing and all that other stuff soon enough, hopefully... Leave me a note here, and tell me what you think!

DON'T refresh a page that was generated as a result of shouting and click "Retry" or "Repost". ALWAYS CLICK CANCEL. Otherwise, this doubles the last post you made. Fix coming soon... But don't do it, really.
Edit: Fixed

Cool, nerd-speak:
There was a peculiar problem. You see, to create a new shout, the code looks for a variable in the URL called "action", with a value of "shout". (Look for it in the address bar the next time you shout)
Well, to do this, I was taking the page you were currently viewing's URL, and adding "?action=shout".

The problem with that is, if you're viewing an entry, the page you are viewing's current URL looks like this:
"entry_view.php?entry=1129&editor=69" or something like that, based on where you were... Adding "?action=shout" to "entry_view..." would yield:
"entry_view.php?entry=1129&editor=69?action=shout" Well, adding another question mark closes the GET array (that is, the array that contains the variables in the URL) so the action=shout thing never got passed. This was bad.

To fix it, I did the following:

if ($_GET['action'] != 'shout')
if (!empty($_GET))
$shout_action = $_SERVER['REQUEST_URI'] . '&action=shout';
} else {
$shout_action = $_SERVER['REQUEST_URI'] . '?action=shout';
} else {
$shout_action = $_SERVER['REQUEST_URI'];
$varless_action = substr($_SERVER['REQUEST_URI'], 0, -13);

$varless_action is another fun little fix. The form's action needed to have "?action=shout" attached to it. (This is a lie: I could have passed it as a POST variable, and probably should've. D'oh!) The problem was, if I shouted and then shouted again, it was doing this:
"page_name.php?action=shout?action=shout" and the like. To be honest, this fix was superceded by the above fix for & and ?. Oh well, all it did was strip the "?action=shout" from the end of the URL. I can streamline all of this now and probably should.

(If you're wondering why I explain my code, it's because it helps me find shortcuts and inconsistencies like I just did. The more you know!™)

New advancements:
ShoutBox now refreshes independently of the rest of the page every 45 seconds, allowing you to monitor things while reading other stuff. This took some crazy iframe code and META stuff... Might write up how I did it later. It rocks.

Even *more* advancements:
Did the cool: Removed the form field from the refresh, but targeted the form into the ShoutBox, and had Mike (FrozNic) help with JS to clear the form when you submit. So now you can chat and contribute without losing anything you're typing or doing otherwise- the page itself won't even refresh. Very cool stuff...

Will it ever stop?!?
Added an auto messenger that posts a shout whenever a new entry or musing goes up. May place restrictions on this later... For now, coolness.
Previous entry: Slashdot says...
Back to The Architect's journal :: Back to the journal index :: The Architect's latest entry
Shoutbox: secret survey says....


   [enlite (J:: M) 1/7/04 5:19 PM]

you know i love it, nice fix btw =)

~Cut and print~
   [noprotein (J:: M) 1/7/04 10:03 PM]

Thanks, both of you... Good to hear it's well-liked!

   [disillusioned (J:: M) 1/8/04 5:56 AM]

<-- Log in to leave a note, or create an account, if you don't already have one


Home | Editor Bios | Musings | Editor Journals

Design and concept copyright 2003, 2004 Chris Cardinal :: Content copyright its respective authors

Synapse Studios: Website Design, Custom Software Development, and Web-Based Applications

OIO Page Processed in 0.035 seconds, using ~13 queries. :: 8388607
Now playing: (At least on Dis' machine)