Category Archives: CakePHP

Auto linking text string having image tags using Text Helper in CakePHP

Recently I found that auto linking urls and emails of a string having image tags within was not possible using text helper in CakePHP. It would try to autoLink url of image src and thus it is broken. I am not sure what the issue is in including a fix or solution which could avoid image tags while auto-linking. Then, perhaps you would have to consider other tags like object src and video urls etc. In fact it would be too tedious to handle all kind of html tags and so and so.. Continue reading

Field type tinyint(1) would not save values other than 0 and 1 in CakePHP

Just a quick note. I had a “is_active” field in my users table which i had been using to store boolean 0 and 1 values. Later, i mean today, i decided to save a new value -1 to this field but when i did try, it would’t save -1 and would always save it as 1. After looking at a few blog posts around the web i found that in CakePHP every time you try to save a value other that 0 or 1 into a tinyint(1) field it would save it as 1 (as according to Nate, Continue reading

Security component black hole, form submit dies on a blank page with no error

The problem started when i used Auth component in my current CakePHP project. Everything seemed working fine until i created an html form, submitted it and tried to retrieve this form’s data in controller action. I tried to print $this->data in controller action but it showed nothing and ended on a blank white page (which is called “blackHole” in Security component’s language). Continue reading

Fix to jQuery plugin does not work on ajax loaded content

I had been loading table records through ajax pagination using jquery. Some of the urls/links (View Details, Edit and Delete) in loaded content had been using thickbox to handle respective requests. Although, if i did’t use the ajax to load records these links would work fine and thickbox would open. But once i introduced ajax they suddenly stopped working. Continue reading

Cakephp pagination and custom named arguments handling

Let’s have a look at the scenario first.

I have a “contacts” controller, a “display” action in it(controller) and a view “display.ctp” to show results. As normal my “display” action lists all the contacts by calling $this->set(‘contacts’, $this->paginate(‘Contact’)) inside the controller action “display”. The view works normal. Continue reading