An experimental CMS using Google Drive Spreadsheets.
- Go to https://drive.google.com/
- Create > Spreadsheet
- Create key-value pairs where the A column contains the key and the B column contains the value
- File > Share... > Who has access - Change... > Anyone with the link > Can view
| A | B |
|---|---|
| h1 | This is a header |
| paragraph | This is a strong paragraph |
| nav1 | About |
| nav2 | Work |
| nav3 | Contact |
| text1 | Hello world! |
Replace <KEY> with the spreadsheet key from the URL:
<?php
if(($handle = fopen('https://docs.google.com/spreadsheets/d/<KEY>/export?gid=0&format=csv', 'r')) !== false) {
while(($data = fgetcsv($handle, 1000, ',')) !== false) {
${$data[0]} = $data[1];
}
fclose($handle);
}
?>This converts the A column in the spreadsheet into values to be called like so:
<h1><?= $h1; ?></h1>
<p><?= $paragraph; ?></p>
<ul>
<li><a href="#"><?= $nav1; ?></a></li>
<li><a href="#"><?= $nav2; ?></a></li>
<li><a href="#"><?= $nav3; ?></a></li>
</ul>
<p><?= $text1; ?></p>