Shift Edit v0.1.9 Alpha
Beginning with this version, the most recent content is served up with the page, instead of hitting the server with Ajax (unless you’re browsing the version history - F2). To keep integration as simple a possible, just like the Javascript initiates itself wherever it finds an element with class="Wiki", so to does the server-side code. By buffering the output and hitting a custom callback function, the server-side code displays the most recent content inside any HTML elements with class="Wiki". There’s no need for any PHP on the page except two lines at the top.
Let me know what you think of this technique. One of the downsides of using a buffer is a bit more work on the server before any content is sent back to the browser. Eventually, I’d like users to have three options to integrate ^edit with their sites. Each method will require using HTML elements with class="Wiki" and a unique id.
- Just add the Javascript to the HTML head and Ajax will load the most recent content
- Add an ob_start buffer to the beginning of the PHP page and the server will serve up the most recent content
- Call a PHP function directly to get the most recent content
As always, all comments are mucho appreciated :D I also prepared a "real-world" example for you this time so you can see it can do more than just a two-paragraph page
Demo v0.1.9 (Mozilla/Firefox, IE, Safari)
"Real-world" example (copied from the CBC)
I ran across this entry from technorati. It really looks like an interesting technique. But I can’t figure out what you mean from just this blog, and the URL doesn’t give me any hints about ways to get up the directory tree to figure out what you mean. I guess I’ll go try the root URL and see.