Yesterday I spent the day keeping myself busy with my blog supplement pages. I'm finally taking the time to learn php. I'm re-writing all my non-blog pages in php. The great thing about that is if I want to change something in the sidebar or whatever, I don't have to go through and make that same change over and over in the html code for each individual page. I'll change it once in the main php code, and it will take effect on every page.
The actual blog is hosted by Blogger, and thus will be unaffected by all of this.
Basically, I'm using the require() function to paste in all the code that is the same on every page; things like the sidebar and footer. It reduced the actual .html files for the web pages down to the content that is unique to that page. As an example, my template page that I use to create new pages was 200 lines (before actual content is added), now it is 31 lines.
None of the web addresses or file names are going to change, though. You'll notice they still have their .html extension. In fact, the files themselves are still .html files. I just told it to run .html as a php file with a little .htaccess magic:
AddType application/x-httpd-php .php .htm .html
AddHandler x-httpd-php .php .htm .html
Also, the non-www version of my web address finally 301 redirects to http://www.mastermarf.com, as I've wanted it to all along.
I'm sure there's so many neat things I could do with php, I'm just beginning.
See the rest of “Learning PHP”»