Archive for the ‘CakePHP’ Category

Yet another way to customize your flash messages – with a helper

Thursday, October 7th, 2010

Just in case you’re not familiar with the basics, I suggest you read James Fairhurst’s and teknoid’s posts first. Good stuff but doesn’t work for Auth messages because you can’t specify parameters when Auth calls $this->Session->setFlash().

So I decided to ignore the phase where you set the flash message and hack the phase where the message is being printed. I created a custom helper and extended/overrode SessionHelper.


CSS class or id in a SELECT box OPTION? You can!

Friday, October 1st, 2010

I’ve been wrestling my mind around a rather simple request today. I needed to display the first OPTION in a SELECT box in a different colour. Simple in HTML but I just couldn’t find a solution that would do it the cakeish way. Until I RTSC and found that I can specify the options in a more complex way.


Baking with XAMPP on Windows

Monday, September 14th, 2009

I’m not sure if it’s just my set-up but when I run cake.bat and say, try to bake a model I get

  2. Fatal error: Call to undefined function mysqli_connect() in C:\…\cake\libs\model\datasources\dbo\dbo_mysqli.php on line 73

The reason is that php.exe when run from a command line uses a different php.ini than PHP that’s run as an Apache module. To fix this edit cake.bat and add -c"C:\xampp\apache\bin\php.ini". This is the path where XAMPP placed php.ini.

Getting rid of JOINs in updateAll() query

Sunday, September 13th, 2009

I guess I haven’t mastered the model relationships enough in order to appreciate them – and use correctly. On one hand they seem to be really cool and provide an easy access to linked database records while on the other hand, they just seem to stand in the way too often.


Switching layout using a url parameter

Sunday, February 8th, 2009

I needed to open a static page in a pop-up window. For static pages we have a handy controller Pages but I wanted to use a different layout for each page and do it in a flexible way.