Jump to content

WAP/XHTML Chat Room


supertrucker

Recommended Posts

Here's what I want: A very simple chat room, where a logger goes to a screen, types in a user name, and is then able to chat on a page that auto refreshes, say every 10 seconds or so.This "chat room" would be compatable with mobile phones, in other words, no javascript if possible, although most mobile phones can handle a limited version of javascript, must be xhtml compliant, html 4. Is this possible? I have an SQL database, but as far as implementing it, I'm a little stumped and could use some guidance. A few tips and I could be on my way putting together a "really simple chat room".Thanks for your time,Supertrucker

Link to comment
Share on other sites

I take it you don't want any AJAX, so the page itself needs to refresh. You could use either a meta refresh or a 'refresh' header. I suggest that the refreshing page be in an iframe so the user can have a somewhat constant interface.BTW, I believe XHTML and HTML 4 are incompatible because you need one DOCTYPE or another but not both.What else are you wondering about? (Note that I don't use WAP; I'm just going off my HTML experience.)

Link to comment
Share on other sites

I dunno, I just need really simple 123 steps to get me started, from there, I can complicate things myself :) ! I have access to mutliple databases (SQL), and have done a little SQL over the years, only enough to get me by. I'm sure I can do it, as from a Google search I've seen others have done it, just no real examples of, OK, here's the premise, here is what you need to do, and here is how you do it, and here is how you do it in laymans terms... If that doesn't make sense, then I'll need to Google a little bit more. I'm more than apt to learn from example, but I need a slight push in the right direction, e.g., a road map. I would rather not download an entire script that somebody else wrote, I would rather write it myself by listening to lessons from others, less, I put some hackers free back door pass into my web site... ...has happened recently, hence why my site is no longer indexed by Google and why FireFox won't let users access my site... :) ... if you get what I mean...A frustrated, eager to learn, ST

Link to comment
Share on other sites

As suggested, it's wise to keep the chat log in an iframe if you don't want to use AJAX, as otherwise, the user has 10 seconds to type in his/her message. I mean, browsers don't remember input in forms on page refresh (most of the times?). Isolating the chat log in another frame will mean the user is free to read and type as well.The iframes themselves are problematic in mobile phones however, i.e. they're not supported on all phones. So whatever your approach, you simply can't make a good experience for everyone. Face it. The best you can do for users with no iframe support is to present them with a message "Sorry, your browser is not supported."Here is a basic outline of what needs to happen for everyone else:1. Construct a PHP (or whatever S3L) page that will output the current chat log.2. Construct another S3L page that uses an iframe to display the chat log from that first file you created.3. Create a form on that same (second) page that will send the result to itself. Once submitted, the second page must write the message in the chat log, and redisplay the UI.4. Create JavaScript over the second S3L page that will "ajaxify" it, i.e. append the results inline and without iframes.What you should get in the end is:1. Users with capable enough JavaScript will see the "ajaxified" version, giving them the best possible experience. They'd get that regardless of whether their browser supports iframes.2. Users with not capable enough JavaScript or no JavaScript will see an (X)HTML page with an iframe that refreshes to display the new messages.3. Users with no JavaScript and iframes will see an excuse message. Can't help those guys really. Sorry.

Link to comment
Share on other sites

Let's say this is your chatroom as viewed by the browser (the table is legit because it's tabular data):

<ody>    <head>        <title>Chatroom</title>        <style>            form#chatroom table{                overflow: auto;            }            form#chatroom td:first-child{                text-align: right;            }        </style>    </head>    <body>        <form method="POST" id="chatroom" name="chatroom">            <table>                <tr>                    <td>ST says:</td>                    <td>Hi!</td>                </tr>                <tr>                    <td>Chris says:</td>                    <td>Hey, how ya doin'?</td>                </tr>                <tr>                    <td>You say:</td>                    <td><input type="text" name="message" /><input type="submit" value="send" /></td>                </tr>            </table>        </form>    </body></html>

When a new chat session is begun, create a new table for it and record it in a special "sessions" table. When someone enters the chatroom, record the time and session they entered in a special "users" table, and only display messages sent to that session since that time. Build the HTML table's rows from the data in the table and add the two form fields at the end.EDIT: This is a very minimal implementation; boen's suggestions are much better but more complex. I suggest that, like you said in other words, you build the minimal implementation and add on to it after it works.

Link to comment
Share on other sites

  • 3 weeks later...

Thank you for your help, I went the one size fits all for mobiles - using refresh. It probably seems sloppy, but most mobile browsers just do not support javascript. You can get an idea by running almost any standard web page that uses Javascript through ready.mobi, and the results are bound to be ugly!Sorry I brought up some of these topics in another thread, sometimes I forget what I've already talked about, or didn't check my email for responses!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...