Tag Archives: CakePHP

CakePHP’s HtmlHelper::link() Escaping of Attribute Values Gotcha

Just updated pHing Classifieds to CakePHP 1.2.2.8120 and that breaks some JavaScript codes for deleting of messages. Turns out the escape attribute is now passed on to Helper::parseAttributes() so if you have an image link like me, you will have to remember to manually escape the attribute values.<?= $appHtml->link( $appHtml->image('icons/bin.png'), [...]
Posted in Uncategorized | Also tagged | Leave a comment

Working with Associations using CakePHP

I was asked by Niraja Mulye of Packt Publishing if I would be interested in publishing an article on my blog from the book, CakePHP Application Development. Since it seems relevant to any starting out with CakePHP, I guess why not. Instead of copying and pasting what was sent, I found two articles which seemed like [...]
Posted in Uncategorized | Also tagged , , | Leave a comment

What a Start to 2009

5 days of downtime and finally back online. A faulty RAID card leading to all sorts of restoration problems. Totally unacceptable. I have to probably start looking out for a new web hosting provider but what a hassle. For fellow Planet CakePHP subscribers, I apologise for having you missed 5 days of CakePHP news. [...]
Posted in Uncategorized | Also tagged | 1 Comment

Planet CakePHP With Multiple Feeds

Short of having an actual announcement feed for Planet CakePHP, this seems like the fastest way to get information to all you subscribers. If you were wondering about the few non-English items showing up in the feed, you actually have a choice to subscribe to a separate feed which aggregates websites written in English/Portuguese/Spanish. [...]
Posted in Uncategorized | Also tagged | Leave a comment

CakePHP Losing or Missing Session?

I have my fair share of problems with session in Cake so I thought I can share the two important configurations in app/config/core.php which affects how Cake handles the session. Session.checkAgent Setting this to TRUE means Cake will store the user agent header of a request when a new session is created. On subsequent request, the user [...]
Posted in Uncategorized | Also tagged , | 14 Comments

Soft Deletable Behavior and the Model::exists() gotcha

If you ever used the Soft Deletable Behavior, you will realise that Model::del() always returns a FALSE. This is expected after knowing that the behavior intercepts the delete request by saving the deleted flag and date then returning FALSE so the actual delete don’t happen. So since I can’t rely on the returned value of Model::del(), [...]
Posted in Uncategorized | Also tagged , | Leave a comment

Multiple Validation Sets in CakePHP

Jonathon Snook wrote about multiple validation sets in CakePHP and it reminded me how often we require rather different sets of validation rules for a single model. I have always enjoyed learning how others approached similar problems so I think I shall share mine too. A very relevant example is the User model where we usually [...]
Posted in Uncategorized | Also tagged | 1 Comment

Extracting PO file with CakePHP I18n Shell

I have always been religiously wrapping __() and __n() around my texts knowing that it needs to be localized some day. Then it got to me that I never knew how to actually localize it! Out of curiosity, I went ahead to extract the PO file using the I18n shell. What it does is basically [...]
Posted in Uncategorized | Also tagged | 1 Comment