Posts under ‘PHP’

XPath to the rescue. Again?

It’s odd. I don’t think about think about XPath from one month to the next. But once in a while, when my usual solutions have all come up blank. Ta-Da XPath to the rescue! Recently as part of a site I was working on, the design basically required that I inject a block of content [...]

 

Quick debug function

It’s not pretty and it’s not elegant, but we’ve all got a bag of quick and dirty functions that help make life just a little bit easier. This is a simple print_r() but I finally got fed up of loosing my quick debug statements and so added the line name and file number from a [...]

 

Reorder a nested HTML list in PHP

Recently I was working on website where I had to re-order a nested list (part of a navigation menu) – unfortunately I only had access to fragment of HTML so I couldn’t just manipulate the arrays from which it was built. The menu was compiled from various arrays and months within years sometimes came out [...]

 

MySQL DATE_FORMAT() AND PHP date() formats

I’m always finding myself looking up strings to format PHP and MySQL dates. A simple d/m/Y is pretty straight forward but sometimes things can get a bit fiddly. Where ever possible I try and leave my date formatting in the database, but I still find myself doing it in PHP all the time. Here are [...]

 

Lithium, Doctrine & doing it yourself

If you use CakePHP you’ll probably be aware (or you’re dead or on holiday or something…) that Gwoo and Nate have left the project and gone elsewhere. Sort of. Well actually they have forked Cake3 into Lithium – souped up CakePHP for PHP 5.3 Unfortunately I’m not going to be using it in the immediate [...]