Posted by Oliver Saunders on 10/14/05 11:24
> Preferably, I want to implement this without adding a database table.
> I hope to use a combination of both PHP & Javascript. Is this a
> realistic approach?
Its doable. But I think using a database would be easier and give better
performance. Then again if you have no experience of database the former
probably isn't true.
I'd use an XML file.
- Have a form with name and message field or whatever you want. File
called "mainsite.html" say. Give the form action "addim.php"
- In "addim.php" make sure you don't echo anything and just write the
code to add the message to the XML file and then use Header("Location:
mainsite.html") to send the user back to the same page. The user should
see nothing change at all but the processing will have been completed.
- Back in mainsite.html use a frame (anything that you can use to
display something from an external file) to show your instant messages.
Then that will automatically call "parseims.php" every time
"mainsite.html" is loaded
- Create "parseisms.php" to display the last 5 or so entries in the XML
file, and possibly delete those above to keep things fast.
- You could use JS in mainsite.html to refresh the contents of the frame
periodicly which you wouldn't be able to do with inline html code such
as a layer or table. Actually thinking about it you might but its
harder, depends how much you dislike frames.
I might try something like this for my own site come to think of it
Ollie
Navigation:
[Reply to this message]
|