PHP DateTime is missing methods in 5.2
It turns out that in PHP 5.2, the DateTime class is missing a couple of methods (get/setTimestamp) that are available in PHP 5.3. These are some strange methods to be missing as a lot of people in the...
View ArticleRE: Top 10 PHP Techniques That Will Save You Time and Effort
I realise that I already posted something today, but this seemed like an emergency… I thought maybe this was a serious post when I clicked on it, then when I got to number 2 on the list (I had skipped...
View ArticleAn alternative to Poor Man’s MVC in PHP
As written in my previous post ( http://blog.seanja.com/2010/03/re-top-10-php-techniques-that-will-save-you-time-and-effort/ ) I noted that the code for the proper way to write an index file is...
View ArticlePHP Functions, you’re doing it wrong…
Just a quick tip today. If your function looks something like this: <?php /** * A really long function definition * @param string $has * @param bool $a * @param int $lot * @param float $of *...
View ArticleOrms and Circular References
In my spare time I have been working on an ORM… not one meant to be used in the real world (well… not yet anyway). I currently have hasOne and hasMany working like so: <?php /** * @property int...
View ArticleAjaxy Pagination using jQuery
Saw this today: AJAX Pagination using jQuery and PHP with Animation. While it is quite simple to add paging using jQuery, why not make it work without the jQuery as well? It isn’t too hard to do, add a...
View ArticleUsing Valums File Uploader with CodeIgniter
Valums file uploader is a fancy pants ajaxy uploader widgit that is meant to be used with normal php pages. It, by default, doesn’t really play well with CodeIgniter. Fortunately, it isn’t that hard to...
View ArticleDashing Widget For Disqus Comment Count
Obviously you need dashing first: shopify.github.com/dashing/. Here is a screenshot of the result: I went with a blue background and used the comment icon, obviously you can change this… The code is as...
View ArticleDynamic animated countdown clock gif
On stack overflow, user1857868 asked: I recently received an emailer from Onnit Labs that included a Countdown Module Timer inside the emailer using a gif image. The emailer can be viewed here:...
View ArticlePHP Editor in your Browser
Put this into the url bar and hit enter: data:text/html, <style type%3D"text%2Fcss">%23e{position%3Aabsolute%3Btop%3A0%3Bright%3A0%3Bbottom%3A0%3Bleft%3A0%3B}<%2Fstyle><div...
View ArticleGeneric hook_theme for drupal 7
<?php /** * Create a themeable item out of all of the templates in the templates folder * @implements hook_theme * @param array $existing An array of existing implementations that may be used for...
View Article