google_docs_logoI regularly come in contact with clients that have relatively simple websites; just a few basic pages that remain static for the most part. Generally, if they want the ability to do their own content updates and are in the middle of a redesign, I’d recommend doing the whole site in WordPress (a very friendly Content Management System, not to mention lots of expandability down the road if they do decide to make their internet presence more robust). However, there are plenty of situations where time, resources or budget don’t allow for templatizing the site design, upgrading hosts, or putting a full-fledged CMS into play.  What they need is something free, easy and, for the sake of my own humility, Janky.

I started thinking of what online document editing is free, secure, stable, long-term, simple and omnipresent.  Of course, Google came to mind.  For some time they have allowed and even encouraged publishing documents, spreadsheets and presentations as stand alone web pages as well as embedding these documents in existing web pages.

So, I started with iFrames but became less and less happy with that solution for various reasons: inconsistent cross-browser/cross-platform appearance, poor SEO performance for the host page and no end of content/styling complexities. This approach was simply not going to work for any realistic implementation.

Then I remember some content-scraping stuff I’d done a long time ago using PHP.  Why not use it on a web-published Google Doc?  They have a consistent layout and structure, so it should be easy to create a single script that should handle any number of Google documents.

  • A completely non-technical user can edit Google Documents in their existing (or free) Google Accounts with an interface akin to a simplified Microsoft Word (not to mention warm them up to a future with other web-based editors).
  • Users can even use the share feature of Google Documents to allow a small office or team to collaborate.
  • As a designer/developer, I can specify “hot spots” in existing site text content (and even simple images/graphics) and use CSS styling to reduce the user from having to style their input too much if they don’t want to.
  • Can be deployed multiple times on the site and even multiple times in the same page.
  • From a search engine or web visitor point of view, this process is invisible; it all takes place on the server side.

So, a couple lines of PHP later I present the Janky CMS script.  Use at your own risk, totally unsupported.

You can see the script’s output in action here and if you’d like to edit the Google Document which controls the “hot spot” simply leave a comment below with your gMail address and I’ll grant you edit permission to the Google Document.  Play nice, you can be found for abusing Google Documents. Here is a link to the php code.

Note: On some server configurations “allow_url_fopen” may be set to “off”. You can reactivate it for this script with a php.ini in the same directory as files containing this script.