Category Archives: CakePHP

[CakePHP]How to check SQL queries in Shell and Controller


[CakePHP1.3.3] When you debug, within Controller and Model there is often something like SQL from the instant you’ve done $this->find(). At that time, either put the function below into vendor or if you read it in bootstrap you can confirm it in SQL any time. Incidentally, within Shell things stripped of HTML are output so [...]
Posted in CakePHP | 4 Comments

[CakePHP]How to make random id in Model


[CakePHP1.3.3] Sometimes, we want to save random unique id to database. Then, please add this method.
Posted in CakePHP | Leave a comment

[CakePHP]How to get View file name in element or layout


[cakephp 1.3.3]I introduce how to get to know view name in element or layout that is specified by $this->render in controller.For example, with the contact form, as seen below, many times with one action the view is specifed.   But depending on the value of the view, there are times when I want to change [...]
Posted in CakePHP | Leave a comment

[CakePHP]How to save IP address or Host name automatically


I’ve been using CakePHP a lot so I would like to release the tips little by little during break.If it’s CGM type web service, users do some actions and keep them in DB. It’s usual to keep user’s IP addresses at that time to follow users . It takes time to write the codes in [...]
Posted in CakePHP | 3 Comments

[CakePHP]How to create navigation with well thought out about current page


Using layout template is general at cakephp view. There is a global menu in layout template. If we show the selected global menu in each page even if it takes time a bit, it looks neat as the example below which I found at Google group.
Posted in CakePHP | Leave a comment