« Nothing in particular | Main | I need PHP! »
Friday, March 18, 2005
Who needs PHP?
I've been experimenting with a few new things recently. By "new", I mean new to me. It's very easy to get comfortable in your work and stop thinking of new ways to achieve the same result.
The most exciting 'new thing' has to be XMLHTTPRequest. This is an extension of javascript which allows you to load an XML file into javascript which is then available in the DOM tree. It's currently only supported by IE 6+, Safari and Mozilla (Firefox, et all) which leaves Opera and Konqueror users out in the cold.
I've been thinking of how to apply this technology to IPB - or rather, how the technology can solve some age-old problems. For instance; wouldn't it be nice if we could bring up a list of recently replied to topics without having to navigate to a new page. Naturally, one could load this data into a hidden DIV before displaying the content to the browser but then we have to add a rather large query to each page load which isn't very desirable at all.
Enter a little bit of javascript trickery, and we have a way of loading recently replied topics into an otherwise hidden DIV. Each click of the link refreshes the content without refreshing the page. That's pretty nifty.
(The screenshot linked to needs much cleaning up and fixing, but the actual engine is working and please excuse the beat up condition of my private development board. It gets like that.).
There are a few other areas which can be enchanced using these methods. I think we can all but replace the "normal" PHP calendar in IPB with a javascripted version which can load the month's data without a screen refresh. Naturally, those without javascript and/or without a sufficient browser can be directed to a different version - but offloading some of the server side processing to the client's browser is appealing.
It is entirely possible to write a PHP engine which saves data and produces XML data on the fly and write the front end entirely in javascript.
March 18, 2005 | Permalink
TrackBack
TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83423035953ef00d834455d6e53ef
Listed below are links to weblogs that reference Who needs PHP?:
Comments
This sound really cool and looks pretty good :)
Btw: XMLHttpRequest will be supported by the next final release of Opera and is supported since Opera 7.60 Preview 1.
Posted by: Florian | Mar 18, 2005 6:33:54 PM
I've just recently found out about the XMLHttpRequest object too. I've written a little Javascript abstractor function for it, and I've got a nifty little test working in my Helios product. It asks the user for their database server login details, then uses the XMLHttpRequest object to send those details to the PHP backend, which then sends a list of databases available to that user back to the browser.
It works a charm.
On a related note, Google Suggest and GMail both make extensive use of the XMLHttpRequest object. Their Javascript is so heavily optimised, the whole system is as responsive as if you were running the server locally!
Posted by: Philip Withnall | Mar 18, 2005 8:09:11 PM
You are my hero in dark times! I was just thinking about how to load and parse XML without reloading the entire page.
Posted by: Franklin | Mar 18, 2005 9:36:58 PM
I've been following XmlHttpRequest (now commonly Ajax) since Google Suggest and a lot of chatter has gone around. I've already thought of some interesting uses for it in IPB but View New Posts wasn't one of them. ;)
This is certainly the answer to the people who think vBulletin's javascript animations are the coolest thing they ever seen and wonder why everyone hasn't already copied them.
Posted by: Chris Griego | Mar 19, 2005 5:34:32 AM
Thats Brilliant. Perhaps a Similar method could be used to solve the infamous problem with Determining Read/Unread Forums?
Its nice to see a Developer using some new ideas, instead of copying what other Developers have Implemented.
Of course, copying is fine, as long as its the best Solution for your Prodcut.
Posted by: Swords | Mar 20, 2005 3:36:48 AM
Hopefully it works out well, it would simplify things much more.
Posted by: Logan | Mar 20, 2005 4:49:18 AM
I've also recently been reading up about it and written a couple of little proof-of-concept scripts, for those wanting to know more: http://developer.apple.com/internet/webcontent/xmlhttpreq.html.
Posted by: Michael | Mar 20, 2005 7:47:01 AM
However there is also a good trick to know : you can't use anything else you want to return data with XMLHTTPRequest. You can just return "0" or "1" if you want; or a string only "No new messages" ... not only XML.
Even though it can reduce click numbers and increase the navigation comfort, i don't think it must replace existing features : search engine or lowers web clients could be penalized.
Posted by: The Jedi | Mar 21, 2005 2:06:18 PM
I don't think it will be a viable _replacement_ for PHP code ever because of the simple fact that its not accessible and 10% of the web doesn't use it.
Posted by: Michael | Mar 21, 2005 7:53:46 PM
http://www.invisiondynamic.com/screenshots/2-1-alpha-posts.gif
Thats quite good, and surely not the final state, but anyway I would like to suggest to make it appear as a part of a page, like you make it with the quick-reply and options on post-view. Google does also integrate the parts as a page, and not as a floating element.
Posted by: Mike | Mar 22, 2005 12:17:07 PM
This is exactly the sort of thing I've been looking at doing for like... a webcomic thing. But... was planning to like - preload images etc... Might be interesting to look at doing it this way :D
Posted by: Jabberwocky | Mar 23, 2005 9:45:52 PM
Wow, that looks such a cool idea
Posted by: giggsey | Apr 13, 2005 12:57:14 PM