Category Archives: Php

Php–you know you like it!

Lijit WordPress Plugin Revamped


Long ago, when I was slightly younger, in better shape, and maybe even better looking, I threw together a little wordpress plugin that made it a bit easier to add a Lijit Widget to a wordpress blog. Not long after that, I scored a job at Lijit and became so busy I never updated it or even really looked at it again. Until now…

Please ignore the melodramatic paragraph above. The truth is, we decided to get someone with some more wordpress plugin experience to help us out. We enlisted the help of Alex King and the great team at CrowdFavorite to help us create a new wordpress plugin that has more features, and is better integrated with the WordPress platform. The result is a great looking plugin that makes it easy to add Lijit to your wordpress blog,

Whats new:

  • Use your existing account, or create a new account from within the plugin admin menu
  • Choose between the classic sidebar widget, or hijack the wordpress search widget.
  • See your Lijit statistics from your wordpress dashboard.
  • Tighter plugin and admin menu integration

Where to get it:

Goto  to download the plugin and read the install instructions.

Need help or have questions?  Send an email to .

Breathe new life into Fedora Core 4


As I noted in my last post, I recently took the hard and dirty path of trying to upgrade php and mysql on my web server.
This was driven by my need to have PHP 5.13 and support for SimpleXMLElement->addChild() .
Unfortunately, support ended on the standard repo’s for FC4 some time ago. This meant that I would have to download and recompile if I wanted to have an upgrade path for php. I don’t have that kind of energy.
Luckily I was able to use some google-fu, and find a solution.
This site Les RPM de Remi, albeit in french, provides an awesome repo, and compatibility updates for RHEL 4 and 5, FC 3,4,5,6 and more.
This means I had a nice easy path to upgrading php and mysql.
See the details below to see how easy it was to update mysql 4 to mysql 5, and php 5.04 to php 5.25 .

To utilize for FC 4, follow these instructions:
UPDATE: The repo uri has changed below since I last published this.

1 . Install the remi rpm .

rpm -Uvh remi-release-4.rpm

2. Install the remi yum repository.
cd /etc/yum.repos.d

3. Update – Update – Update
This should find all dependencies and include them.
I suggest doing mysql first, as php update may fail if you don’t.

yum --enablerepo=remi update mysql
yum --enablerepo=remi update php

So far everything worked flawlessly for me.
But YMMV. Backup your databases.
Be prepared to re-install your OS, or be smart enough to undo what you are doing.
Use caution, and enjoy.

The best way to self share photos ?

I recently spent a fair amount of time at home as a result of the birth of my son Lucas.
Between naps and feedings and diaper changes, I had a bit of free time available. I used this time trying to find a suitable method of sharing baby photos online.
Flickr was an option, but there is no way my parents or relatives would have been into signing up, and the embedding options weren’t great.
I thought about just hosting on my web site, but iPhoto created some pretty crappy html when you exported for the web. And I couldn’t very easily add new stuff without re-exporting, and then re-uploading to the web server.
I didn’t have the energy or focus to “write my own”, so I searched the Interweb for an answer.
I think I found a reasonable solution. I implemented a cool Flex/php solution called Fotoviewer from FOTOCRIB . It provides a nice little flash photo browsing interface that automatically shows thumbnails in a list view, a carousel browsing view, and very nice and flexible slide show option. Demo HERE
If you know of any better options, or have found something that you like, let me know.

Screen shot

Adding photos is as easy as creating a directory and naming it the way you want the “album” to be named. Photo captions then depend on the file name of the photo. iPhoto makes this easy if you are used to changing image titles and make it a habit. You can simply export the images from iPhoto, and tell it to export using the title as the file name.

The downside to this solution is that it appears to load all the images in the browser at once. If the album is large, and the images haven’t been cached in your browser , or are not “web safe” sizes, it can take a while for all of them to load.

A word of warning. You need php 5.1.3 or better to use this. Fotoviewer stores meta-data in xml files,and implements SimpleXml methods that aren’t available if you are on an older version of php. Specifically SimpleXMLElement->addChild(). This caused me a a whole host of problems that lead me on a fun path to upgrade my webserver.

Overall, not sure this is the best method, but it currently allows me to avoid too much work with the photos themselves, and uploading an image is all it takes to add it to an album.

Full Disclosure

So I am just about to complete my second week working for the best search company on the planet. I am now working for Lijit Networks in beautiful Louisville, Colorado. Although my previous development on the Lijit Wijit plugin for wordpress, was pre-lijit, I will continue to update and work on it via my blog. So if you are looking for instructions and download details on the Lijit wordpress plugin, just click the link “Lijit WordPress Wijit” . All further updates will live there from now on.

Feel free to send an email if you have any problems, and make sure you head over to to make sure you are signed up, and that your blog is wijitized.

My WordPress Lijit Wijit (Widget)

As part of playing with the widget system in the newer versions of wordpress, I decided to take some of my sidebar content and widgetize it.
My first try is a widget that allows you to add the Lijit Search Wijit to your sidebar.

  1. Simply download the file below and unzip the plugin
  2. Upload the myLijit.php file to your /wp-content/plugins directory
  3. Login to your wordpress admin console and activate the plugin
  4. Go to Presentation management, click on the Widgets tab, and you can drag it to any location on your sidebar
  5. Edit the widget by clicking form.jpg, select the title for the widget block, and specify your Lijit username.
  6. Enjoy

Download the code

If you want to learn how to build your own wordpress widget, I followed the code and the tutorial at Blue-Anvil .


Something I should have mentioned about this plugin. This is built to work with WordPress 2.2.* automatically . The latest version of WP contains a built-in sidebar widget plugin.
For earlier 2.* versions, you need to install the WordPress Widgets plugin before your sidebar will be “widget” enabled.

A full tutorial and links to download the plugin, are available at .
It should be fairly easy to install , if you have access to your wordpress installation, and use either the Classic, or Kubrick themes.

Some things to remember when following the tutorial:

  1. Backup your default theme files before copying the new theme files to your wp-content/themes folder.
  2. Activate the WordPress Widgets plugin

If you really want a widget enabled sidebar, you can also go the route of upgrading to 2.2.