M is for MySQL and P is for PHP
For the LAMP series, I’ve decided to focus on WordPress for the nonce. I’m anxious to dig in and start playing with the tool, not to mention migrate the rest of my weblogs. I’ll return to Textpattern at a later time; or we’ll see how Joseph Duemer does with his adventures in Txp land.
My next LAMP essay loads the Movable Type weblog into WordPress, and I’ll post that one in a moment. In addition to this writeup, I’ve also finished my first major tweak of WordPress 1.2, which is to provide emulated support for multiple weblogs. Though it may not be smooth as you’re used to with Movable Type, it is an approach that can be used by those who aren’t comfortable working with PHP.
My emulated multiple weblog support does require copying some–not all– some of the WordPress files into the new weblog directory, but once this has happened, it’s a simple matter of opening up the Switch Blogs page (found in the menu of WordPress after the menu.php file has been replaced) and adding the information about the weblog name, the URL for the WordPress wp-admin directory for the weblog, and the URL to view the weblog.
This information is added into a table (I have a PHP program that creates this), and is displayed in the Switch Blogs page each time it’s accessed. The image below shows what this new page looks like, and how it is integrated into the main WordPress 1.2 interface. Note that only the blogs owned by the person who added them are shown on the page.
I have a g’zipped file of the modified pages ready to look for those interested. If you’re experienced with PHP and/or WordPress and feeling brave–oh so brave–you can download it now and play with the files while I write up the procedure. All I ask is if you run into problems, or have suggestions, please let me know as soon as possible. The modified code is based on the first candidate release of WP 1.2. Follow good procedures and backup your replaced files.
Unzip the files into a temporary directory, and move the files (switch.php, menu.php, and install-multi.php) into your primary WordPress installation’s wp-admin directory. Note that the menu.php file will overwrite your menu.php, so if you’ve made customizations, beware and backup.
After moving the files, run install-multi.php to create the database table (wp_multi_blogs). Then, modify the Switch Blogs entry in menu.php to reflect the URL for your copy of the switch.php page. At this point, Switch Blogs should show in your menu, click on it and add your different weblog locations.
Create the database once, and install switch.php in just one location, but modify the menu.php for each WordPress installation.
More detailed how-to later; however the ease with which I could install this functionality demonstrates the ‘openness’ of both PHP and WordPress. After years of working with complicated frameworks such as J2EE and COM+, or crypic languages such as Perl, I’m finding that working with a language such as PHP is such a joy.
And there’s a new version of PHP coming out. Once this series moves beyond the work with WordPress, perhaps I’ll take a more detailed look at it. However, its unlike that PHP 5.x will be available on most systems for probably about a year, as widely used PHP applications such as PHPMyAdmin go through the upgrade process.
Or if it is available, it’s only so under a different naming convention. Hmm, I wonder if Hosting Matters has it installed…