PHP includes for Blogger
Before writing this post, I looked online to see if others have written about this same topic. This might as well be Michael Gray’s “Integrating Blogger Into Your Website: Part II”, which he never wrote — though he did write Part I.
Step 1: Switch Blogger files to PHP
First, you need to update your publishing settings so that Blogger publishes your posts in PHP, not HTML (thanks to DevDoctor):
- Set up your blog to publish via FTP (on Publishing tab)
- Change the ‘Blog Filename’ to index.php
- Change ‘Archive Filename’ to archive.php (on Archiving tab)
- Finally, delete the old index.html file from the blog directory (otherwise it will probably take precedence over the new index.php)
Once you’ve got Blogger pushing out PHP, you’re able to do PHP stuff with the site:
- Update the entire site at once – When I create a website, I always want to create the structure using PHP includes, so that I can set global site variables, and if I change it in one place, it changes across the whole website.
- Set active navigation – Using SSI includes, I used to have to include a different file for each blog section on the site so that I could up. Here, I just send a variable to the navigation.php file, which tells it what page is active.
Next, I will show how to include these files. Continue reading “Integrate Blogger Into your PHP Website using Includes”