Realising Designs Articles


Date icon Posted: October 29th, 2009

Post icon Using Google Docs as a quick and easy CMS

Google Buzz

In search for a simple CMS to use on a holding page, my thoughts turned to Google Doc’s.  10 minutes later I had a script that works very nicely, so thought I would share it. To use:

  1. Create a Google Document
  2. Click ‘Share’
  3. Click ‘Publish as a website…’
  4. Copy and paste the document reference into the script e.g. http://docs.google.com/View?id=dd9zpc9r_4jh8qv76j

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
// Use the script freely , but if it's useful then please post a comment - thanks James
// Ps. the array is used to later experiment with spreadsheets etc...
 
// Specify document
$gd_doc = "dd9zpc9r_4jh8qv76j";
$gd_doc_type = "doc";
 
$gd_array = array();
 
$gd_array["doc"]["url"] = "http://docs.google.com/View?id=".$gd_doc;	
$gd_array["doc"]["start"] = '<div id="doc-contents">';
$gd_array["doc"]["end"] = '<div id="google-view-footer">';	
 
$working_doc = file_get_contents($gd_array[$gd_doc_type]["url"]);
$gd_start = strpos($working_doc,$gd_array[$gd_doc_type]["start"]);
$gd_end = strpos($working_doc,$gd_array[$gd_doc_type]["end"]);	
$gd_content = substr($working_doc, $gd_start, ($gd_end-$gd_start) )
?>
 
<?=$gd_content?>
Share This Post

Share this post:

Delicious Icon   Digg Icon   Redditt Icon   Facebook Icon   StumbleUpon Icon

Leave a Reply

CommentLuv Enabled


Copyright © 2005-2010 Realising Designs Limited

Tel: 0800 634 8536 / Itnl +44(0)1227 787027

Home