February 3, 2010
OVO Creative Group launched their new web site
Category: JavaScript, PHP, Tags: CMS, JavaScript, JSON, PHP, khadlock at 1:22 am
OVO is a branding consultancy specializing in naming, visual identity and integrated marketing for organizations seeking to launch, grow or reinvent themselves. We developed OVO's web site based on their original designs. Using PHP and MySQL we created a content management system (CMS) for OVO to manage their client projects and organize their project slideshows. We also developed a custom JavaScript slideshow widget that randomizes and animates OVO's projects based on a custom JSON feed. Read more...
February 2, 2010
The One Less Flight website has been released
Category: Graphic Design, PHP, Tags: Design, PHP, refback, WordPress, khadlock at 12:24 pm
Miskeeto, a world-class user experience strategy and evaluation consultancy led by Robert Hoekman, Jr. recently released the web site One Less Flight (OLF). We designed and developed OLF based on Robert's concept of getting companies and individuals to commit to reducing carbon emissions by taking one less flight each year. The concept was to offer badges/banners for people to put on their web site to show their commitment to the cause. By adding the badge to a web site the domain of that web site would appear on the OLF web site to feature the commitment.
I looked into a few ways of making the domain addition work; trackbacks, pingbacks and refbacks. I ended up choosing refbacks because pingbacks and trackbacks are limited to working only with other trackback-enabled or pingback-enabled web sites, which essentially limited the site to working with other blogs. On the other hand, the refback method allows anyone to use a badge on their site and automatically appear on OLF regardless of how their site is set up.
The custom refback method works through the actual image request. The image request goes through php, which does the following:
- It verifies that the domain has not already been added to a list of linked domains.
- It adds it to the list if it does not already exist.
- It then returns the image based on the banner requested.
- When someone comes to OLF the list is read and the domains are displayed.
Here's the result: One Less Flight
Special thanks to Stephanie Sullivan for her beautiful CSS coding of my original design!
November 13, 2009
Convert GET and POST to objects
Category: PHP, Tags: Forms, PHP, khadlock at 1:51 pm
Here's a quick way to convert GET and POST arrays to objects with PHP:
$get = (object)$_GET; echo $get->sample;
$post = (object)$_POST; echo $post->sample;
In this case the "sample" property would be an array key.
November 3, 2009
decompress gz with php
Category: PHP, Tags: exec, gunzip, gzip, PHP, khadlock at 9:14 pm
I had a lot of trouble getting zlib to work today with PHP on our Media Temple DV server, but after a lot of testing discovered an easy solution to decompressing/unzipping .gz files.
exec("gunzip Filename.gz", $results);
Once decompressed I can read the file contents using fopen, file_get_contents, etc.
More information on the gzip commands can be found at http://en.wikipedia.org/wiki/Gzip
November 2, 2009
Remove empty array values in PHP
Category: PHP, Tags: PHP, khadlock at 7:51 pm
Here's a super easy way to remove empty values from an array in PHP:
$a = array_diff($a, array(""));
In a recent project we were reading in a text file and creating an array based on each new line, so we used the same method to remove any new lines that were empty.
$a = array_diff($a, array("\n"));
