CMS like WordPress are great for easily uploading and editing content, using templates and databases, but what if you don’t have a database, only HTML files?
- add .PHP to all files,
- cut out the head and footer, adding them to external files so that only the body text is in your PHP files
- add this for the head and foot of each page
<?php include $_SERVER[‘DOCUMENT_ROOT’].”/head.html ?>
<?php include $_SERVER[‘DOCUMENT_ROOT’].”/head.html ?>
And there you have it, template.
Done.
Why this is awesome:
- If you need to edit something in the header or footer, you can edit it once, in these two files, rather than editing every page. This is similar to the logic behind external CSS
- If you want to change the template of your website, you can just edit these two files
- You don’t need to install a database driven program to run your template