WordPress Plugin: WordPress Page Contact

Since WordPress does not provide any kind of author widget to go along with a post or page I decided to roll my own. I feel like it’s a nice thing to get the contact details for a person responsible for a specific section of the page right on this page, and a widget seemed like a perfect fit, so this is how WordPress Page Contact came into being, as my first listed WordPress plugin.

The structure is rather simple: create a database of contacts and associate them to a page or post via postmeta, which can be retrieved easily upon display. Rollup the information in a widget to display in the sidebar for any given entry and here we go.

Since I didn’t find anything similar I decided apply for it to be listed in the Plugin index so here we are. You can find it as WordPress Page Contact.

Enjoy!

MySQL Gem 2.8.1 on MacOSX Lion

Just because I keep googling it:

To install MySQL 2.8.1 on OS X Lion

1.

export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"

2.

env ARCHFLAGS="-arch x86_64" sudo gem install mysql -v='2.8.1' -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config

Thanks Stackoverflow

Give me my $_POST, or a JSON helper for CodeIgniter

In a current Project I’ve been working with a Cappucino frontend and a CodeIgniter Backend. Since Cappucino just loves JSON I decided this is the way to go, sadly PHP doesn’t provide a standard way to interact with a JSON POST but with a little helper this can be solved easily. I made a Gist out of it so it can be improved apon and reused.

https://gist.github.com/1826959.js

FirePHP and Codeigniter 2

Working on a Codeigniter 2 Project right now I decided to give FirePHP a spin since it was pointed out to me for being somewhere around the next best thing to sliced bread for PHP Debugging… or something like that. It really seems nice so far I have to say!

Looking for some Codeigniter library but only finding a CI 1.7 one I decided to try to just drop in the provided code from the FirePHP site and guess what it just works. Download the FirePHPCore, currently 0.3.2,
and unpack FirePHP.class.php to the Codeigniter application/libraries folder (I also renamed it to firephp.php as well). Now the library can be loaded either via adding it to the autoload.php as

$autoload['libraries'] = array('firephp');

or just load it when needed via

$this->load->library('firephp');

I prefer to autoload since I only load it in my development autoload.php anyway. Having different configs for development and production is as easy as setting up a directory structure like the following and just drop the configs in the environment folders.

Codeigniter Config Directory

Now it is time to install both Firebug and the Firefox FirePHP Plugin for Firefox 8+. Currently the latest FirePHP needs to be installed via the link since the one provided as stable via Addons is not working with Firebug 1.9. Get the latest from the FirePHP site or you will get an error.

Thats it! Now logging a message is as easy as

$this->firephp->log("FirePHP is working!");

FirePHP Log