Blogger Templates and php files
Posted by ark, ,
So I love blogger (dot com), it rocks, my biggest problem with it is the pain in the ass template system. I think I've found a solution I'm happy with, it allows me to edit a template on my own machine and see results instantly and then copy it over to publish it on my site. It's a lot better (for me) than using the editing textarea on the blogger site and waiting for a publish that may, or may not, work. Since it requires PHP on your server you have to be publishing to your own server via ftp or sftp. If you don't have PHP get it and continue reading...

A word of warning... If you've already started on your blog and have posts and everything then you'll need to change the filename of your main page to index.php and then it's always good to rename your archive page to be a .php too. Republishing your entire blog wont rename all your old entries to .php, you need to go and pretend to edit, then publish every single one of them to make them all .php files. Start at the bottom of your list of posts to the links to previous articles is all correct (this is the voice of experience talking here).

So Here's how you do it...

Save template.txt as your template in the blogger.com UI. Make sure the paths in the include point at the file location of your blog.template.php file.

Save blog.template.php in the place you pointed your blogger.com template at on your server. You'll see a pattern where the includes in your blogger.com template match the strings in the blog.template.php. You'll notice I called mine blog.template.txt on my server, so you can view the source correctly and download it. You must call yours blog.template.php.

So here's the almost clever bit, you can point your browser at blog.template.php and you should see what your blog looks like. You should make a copy of it, call it blog.template.dev.php in the same directory as blog.template.php. Now you can view your blog with ?template=dev and it will load your other file, this will allow you to work on the look of your blog and then when you're happy with it you just copy blog.template.dev.php over blog.template.php and you've 'pushed' your new look.

So I can hear you wondering... If he has all this fancy pants template stuff, how come his site still looks like shite? Well, I'm afraid it doesn't come with any boost in graphic design skillz. Hope you find this useful.

Comments

Posted Sunday 4 December 2005 Share