Unobtrusive AJAX Commenting System

Yoan BlancTue, 27 Feb 2007, , , ,

I’ve finally made my commenting system using ForkJavascript, JSON and PHP (yes, this web site is no more entirely static). The idea is to support The Comment API, but for the moment, it’ll only support simple comments. I need to test how this works to try to go further.

For every entry, a JSON file is created. Some JavaScript read it and display it in here, and it also JavaScript that is responsible to send the comment. In the backend, a little PHP script (with tests) writes the comment inside the JSON file. Don’t be afraid, every email address is hashed in a md5 (mainly for gravatar purpose).

Let’s comment. Trackback, pingback, post-it and other remote comments will come afterwards I hope.

Je me suis enfin concocté un système de commentaires, chose difficile car ce blog fonctionne principalement avec des fichiers statiques. Jusqu’à présent seul un fichier PHP faisait l’affichage de la première page. Là, un système combinant ForkJavascript, du JSON et du PHP s’occupe de récupérer les commentaires, afficher un formulaire et traiter ce formulaire, le tout sur un page HTML statique ne contenant pas de JavaScript spécifique.

À vos commentaires ! Pour les curieux, installez Firebug et regardez ce qui se passe dans la page pour comprendre.