About Weblog Projects Contact

Weblog of Jon Gales

Re-visiting PHP Nuke

Filed under: PHP, Rant | 2 Comments »

I just downloaded the latest version of PHP Nuke to take a look at how the source has progressed (I haven’t done much with it since version 5.X which is what MacMerc still runs, though we’re going to switch to Drupal). Well, it hasn’t gotten any better (either in code quality or user experience). PHP Nuke may be the most bloated CMS ever. Look up feature creep in the dictionary and you’ll see a picture of Francisco Burzi in a PHP Nuke shirt. Amazing that it is still being actively developed.

I’m glad I wrote these guys off years ago!

Mobile flight tracking

I just put up another new mobile service on my projects pagemobile flight tracking. This is part of my ongoing annoyance with the mobile web and my attempt to make it easier. When I’m on the go I want very specific data without any fluff. To use the new service, just enter a flight number into the tracking box and you get a bunch of data about it. Example.

I haven’t tested it too much (I need to pick someone up soon so I made it on the spur of the moment) so let me know if you find a bug. It works with data from Google and a travel website. The advantage of this over some flight tracking services is you can enter it in plain English (US Air 723 for example) instead of choosing stuff from pull downs.

Your mobile device will need to support XHTML.

One of these days when I have a bit more time I intend to wrap these services into one page, using radio buttons or keywords to define what data you want.

Weighted catgory list at MobileTracker

Filed under: PHP | No Comments »

I put up a spiffy looking weighted category list of our posts over at MobileTracker. I love this view. Yes, we copied Flickr. I modified the code here to better deal with ‘ and " which throw PHP up sometimes. Building lists like these is actually pretty simple.

MovableType multiple domain search redux

Filed under: PHP | No Comments »

A while ago (yikes, over a year!), I posted a hack to get MovableType to be able to use multiple URLs for search forms. Why would you want to do such a sick thing? Well if you host multiple sites, it’s tacky to use the same domain for all the searching. It has been proven that only .0168% of people notice URLs these days, but I’m a total URL-ist and need ‘em pretty.

The problem with my previous hack was that you need to mess with the CGI files. This is just not fun, and every time you upgrade your installation you have to worry.

My new hack uses PHP, but seems to work fast. There’s technically a little more work (the server fetches the CGI results), but unless you’re powering Google it probably won’t be much to notice. It also works a bit smarter and changes the default search form that appears on the results page to reflect your new URL and change it to a GET query.

Get the code here.

NAPP Gallery launched

Filed under: PHP | No Comments »

Tons of work and a lot of tweaks compiled to make the new National Assosiation of Photoshop Professionals Member’s Gallery. It is launching today and is the largest PHP project I have ever done. It seemed simple at first, but it quickly got more complex (it’s still pretty simple for non-members).

If you’re a NAPP member (it’s $99 a year and is well worth it) you can upload up to 24 images that showcase your work. If you’re not a member you can at least look at all the images and hire someone cool.

I’m sure there are still some bugs, and by the time you read this (I programmed it, positive thinking in action) it could very well be overloaded, but it has turned out really great. In a few days it will be even better.

I have new respect for Flickr. And just in case you’re wondering, I am not actively seeking development contracts–I go back a long way with the NAPP and gave them time I didn’t have.

PHP 5 released

Filed under: PHP | No Comments »

Oh man. Going to have some fun with this. PHP 5 is out, for real this time. Now I just have to figure out how to compile it on OS X. I have only done binary installs in the past. Any tips? Update: This looks like it will work.

I am excited about v5 because it has some new XML/SOAP stuff (should make it easier to tie in with some common APIs) as well as SQLite. The new object stuff doesn’t hurt. It will be a fun few days.

PHP mailing list software

Filed under: PHP | 1 Comment »

Anyone have a suggestion for a good PHP based email list script? Here are my needs:

  • Not tag emails as “powered by”. It needs to look like we sent it by hand.
  • Work well with a lot of addresses (10-20K)
  • Be able to run automatically. I want a daily/weekly newsletter, I want to be able to provide it the content which will self update, and it will send these things out via crontab.

That last one might be a problem, so I might have to write it myself. Any suggestions on how to send large quantities of email? The list won’t be huge for a little while, but I don’t want to hit a brick wall (I assume it will be under 1,000 for a while).

The solution does not have to be free, I’m not objected to paying for quality code.

What are your iTunes habits? [code included]

Filed under: PHP | 3 Comments »

iTunesSometimes I have way too much stuff to do, but get stuck on an idea that really is useless. A few nights ago was one of those times. We all know that iTunes uses XML to organize the library, and that it tracks how many times we finish listening to a song. So I told myself….

  1. iTunes knows how many times I’ve finished (doesn’t count if you stop the song before it finishes) all my songs.
  2. iTunes knows how long said songs are
  3. Why can’t iTunes tell me how long I have listened to my music?

Well folks, it can. It just isn’t built in. There is probably some shareware app that does it, but I figured I’d give it a stab in PHP. Why PHP? I like it. Yes ,Perl would be better because all OS X users have it without screwing around, but I don’t like Perl.

Ergo, I wrote some code to massage iTunes’ library in a web scripting language. Most of the code came from here–it’s well written and open source. I just edited to my uses.

IF YOU DO NOT HAVE PHP WORKING DO NOT COMPLAIN THAT THIS DOES NOT WORK. IF YOU NEED HELP, TRY MY WEB SERVING MADE EASY ARTICLES

The .zip file includes a [tiny] demo “library.xml” file that you can try right off the bat. Before long you should copy your file (~/Music/iTunes/iTunes Music Library.xml) to the folder you just decompressed. Rename it library.xml. Put the folder (it should be called itunes) in your web directory and pop up your browser to http://localhost/itunes/. Depending on your machine speed and your library size, before long should pop-up how long you have listened to iTunes, how many songs you have listened to and how many songs you haven’t. Neat!

Remember that you surely have listened longer, this only tracks SONGS COMPLETED.

Anyone used Drupal? [updated]

Filed under: PHP | 3 Comments »

Anyone out there used Drupal before? Thinking of using it for an upcoming site… Looks really slick. I really like the taxonomy feature.

Update: I think I’m going to use it for the project, which while I’m updating, is Tampa411.com.

Printing money with PHP

Filed under: PHP | 1 Comment »

I recently (a few minutes ago) had to output human readable values for money with PHP. While PHP may love to work with values like “10.5″, humans like to read “$10.50″. We also round money to 2 decimal places unless gas is for sale and the extra 9/10 cent is added in to trick the customers. There is probably a built-in function that does this, but I couldn’t find it. And as you can see, the solution is really short:


function makeMoney ($value) {

$value = round($value, "2");

if (ereg("^([0-9]*\.[0-9])$”, $value)) {
$value = $value . “0″;
} else if (ereg(”^([0-9]*)$”, $value)) {
$value = $value . “.00″;
}

$value = “$” . $value;
return $value;
}

Read on for examples.
(more…)