Archive for the ‘PHP’ Category

jQuery JSON with PHP json_encode and json_decode

Friday, August 15th, 2008

Update: There is now a real world example called Shortening multiple URLs with jQuery, PHP, picolisp and bit.ly, you might want to check it out when you’re done here. It uses jQuery JSON extensively. Another one is Multiple select lists with jQuery and JSON.... Read More

Extending PHP Doctrine Record – Check Box Groups

Monday, August 11th, 2008

I simply knew we would need the extension capability that the Mdl class allows for sooner or later, I didn’t expect it to be this soon though. The main problem here is saving a many to many relationship straight to the database from the $_POST array, to do that we can extend Doctrine Record with a new function I have named fromArrayExt which adds something extra to the normal fromArray method.... Read More

Smarty and Doctrine combination

Friday, August 8th, 2008

I’ve had problems with both Zend Session and the Zend Controller. It just feels like too much fighting and since the plan is to replace Zend DB with Doctrine there is only the controller and session left and unwanted to boot.... Read More

PHP Doctrine introduction for dummies

Tuesday, August 5th, 2008

It was long overdue but finally I’ve taken a look at Doctrine. And I’m blown away, bye bye Zend DB.... Read More

Fluent Arrays and Strings in PHP – Adding JSON and more

Friday, July 11th, 2008

Recently I’ve had the need to extend the interface further, among other things with JSON support. I’ve used code published by Nicolas Crovatti to do this. There was one line in there though that wasn’t consistent with its purpose. If you use that code you have to replace if($i != $keys[$i]) with if($i !== $keys[$i]). On the other hand if you use PHP >= 5.2 you don’t need this function at all, you use json_encode instead.... Read More

Fluent Arrays and Strings in PHP

Monday, June 23rd, 2008

I’ve been working some with jQuery and Ruby lately, as you might know they both have very neat fluent interfaces for writing short and easily understandable code. Especially Ruby’s array and string handling should be something that can be done in PHP so I started googling for something nice but so far the best I’ve been able to find is pooQuery. Update: Apparently pooQuery really is a joke (see the comments at the bottom of this post), anyway here is an example from it of how fluent stuff can go too far: ... Read More

Nice ZF, jQuery and Smarty combo

Thursday, June 19th, 2008

Today I noticed a nice, short example of the Zend Framework, jQuery and Smarty stack I’m using. It’s got a lot of niceties from each component in a very small space, perfect for showcasing each and how they can be integrated!... Read More

Extending Zend DB Table

Thursday, June 19th, 2008

For some time now I’ve been working on an administrative backend system. I quickly found the need to extend DB Table with more stuff than needed when I extended the Zend Framework, it’s mostly convenience functions designed to reduce repetitive code snippets. ... Read More

PHP import and export

Wednesday, May 21st, 2008

God how I hate Webmin. No wonder everyone is using phpMyAdmin, everyone except my admin of course.... Read More

IP to Country

Tuesday, March 18th, 2008

Since I’m currently working with advertising related stuff it might be a good thing to learn the whole geographic location by ip number thing. A good starting point is The IP-to-Country Handbook.... Read More