Archive: cakephp
-
Sep 02, 2011
Comments OffHow to Build Web Apps Faster in cakephp?
The pressure is on. You’ve got limited time, and you need a system to catalogue your extensive movie collection in 15 minutes. Who ya gonna call? CakePHP of course! CakePHP is a rapid application development framework that covers all the common tasks required to get a web application up and running. Handling all the repetitive...
-
Sep 02, 2011
Comments OffBuild a file sharing application in cakephp
The honeymoon is over baby. Now it’s time for the real work to begin. This iteration of our CakePHP tutorial series will result in your very own file-sharing tool. This is handy in the situation that you have a file you need to send to a business partner or client, or share with a friend,...
-
Sep 02, 2011
Comments Offhow to Build a bookmark site in cakephp?
If you’ve followed our last few tutorials, you’ll be a CakePHP expert by now: you know how to navigate controllers, delve into the depths of models and create views that astound your viewers. But having a taste of the sweet rapid development that CakePHP offers you, you want more, and you want to do more...
-
Aug 29, 2011
Comments OffDon’t want to use view file for any controller action in cakePHP
Simply write this line in the action of controller for which you don’t want to make .ctp file. 1 $this->autoRender =...
-
Aug 29, 2011
Comments OffViewing the SQL queries that are running behind the scenes
You can easily see the SQL queries that CakePHP is running by adjusting the DEBUG constant in config/core.php. 0 is production, 1 is development, 2 is full debug with SQL, and 3 is full debug with SQL and dump of the current object. I typically have debug set at 2, which renders a table at...
-
Aug 29, 2011
Comments OffWhy cakePHP, and Why Not any other framework?
It has been for years in the market with strong support in the form of communities and online documentation, it supports php 4/5 , sometimes it becomes mandatory to support php4 because of client’s limitation in support php5, there cakephp...
-
Aug 29, 2011
Comments OffHow to Create a controller that uses other models in cakePHP
Suppose you have a controller that needs data from a bunch of different models, simply add this to the top of your controller: 1 2 3 4 class yourController extends AppController { var $uses = array('Post','User'); } This controller would then have access to both the Post and the User...
-
Aug 29, 2011
Comments OffHow to add Logging errors in cakePHP
1 $this->log('Something broke'); This will log your error to /tmp/logs/ (I initially made the mistake of thinking it would log it to the apache error...
-
Aug 29, 2011
Comments Offhow to Call exit() after redirecting in cakePHP
This should be no surprise to anyone who has done any serious web development in the past, but make sure you call exit() after running $this->redirect() if there’s code afterward that you don’t want to run. I’ve always done this in the past, but I made the assumption that $this->redirect() would make an exit call...
-
Aug 29, 2011
Comments OffHow to get single / custom fieldname value from Resultset in cakePHP ?
//Here you will get 1 row matching with $id $this->Modelname->id = $id; //Here you can get the value for particular field $getFieldvalue =...
-
Aug 29, 2011
Comments OffcakePHP Session Timeout Logout Problem – Unexpected Logout and Session Break
Please make the Security Level for Session ‘medium’ or ‘low’. Because ‘high’ Session timeout will break sessions of cakePHP in very short time. Have look at the following code. APP -> CONFIG -> CORE.PHP 1 2 3 4 5 6 7 8 9 // Access the following code in APP -> CONFIG -> CORE.PHP *...
-
Aug 29, 2011
Comments OffStatic pages – Adjusting the page title in cakePHP
If you’re using the pages controller and you need to change the page title, add the following to your view: 1 <? $this->pageTitle = 'Title of your page.';...
-
Aug 29, 2011
Comments OffHow to increase Session Timeout in cakePHP?
Have look at the following code. APP -> CONFIG -> CORE.PHP 1 2 3 4 5 6 // Access the following code in APP -> CONFIG -> CORE.PHP /** * Session time out time (in seconds). * Actual value depends on 'Security.level' setting. */ Configure::write('Session.timeout', '3600'); //3600...
-
Aug 29, 2011
Comments OffcakePHP :Creating a model for a table that doesn’t actually exist in the database
I needed a way to create a model and controller without actually having an associated table in the database. I particularly wanted to make use of the $validate array so I could easily validate my fields and keep the validation logic in the model. CakePHP will throw an error if you create a model for...
-
Aug 29, 2011
Comments OffJQUERY cakePHP – Enabling submit button if text entered
jQuery code snippet: 1 2 3 4 5 6 7 $('#username').keyup(function() { if ($('#username').val() != '') { $('#submit').removeAttr('disabled'); } else { $('#submit').attr('disabled', 'disabled'); } }); It ensures that the submit button is only enabled if the “username†input field is not empty (you can see such a behavior on twitter for example). However, the snippet...
-
Aug 29, 2011
Comments OffHow to Enable / Disable CACHE in cakePHP – CACHING Feature
You can use the cache feature in cakePHP. Have look at the following code. APP -> CONFIG -> CORE.PHP 1 2 3 4 5 6 // Access the following code in APP -> CONFIG -> CORE.PHP /** * Turn on all caching application-wide. * */ Configure::write('Cache.disable',...
-
Aug 29, 2011
Comments Offhow to Create a custom 404 error page in cakePHP
If you need to change the page that users see when a document is not found, create: 1...
-
Aug 29, 2011
Comments OffcakePHP Certification (cakefoundation.org) – How to get Certified?
Certification With growing popularity of CakePHP, you can benefit from becoming a CakePHP certified engineer. CakePHP certified engineers will be listed below and will be able to use the CakePHP trademark when promoting their services. Becoming a CakePHP certified engineer is easy. 1. Build an application in CakePHP 2. Refactor your code 3. Tell us...
-
Aug 29, 2011
Comments OffcakePHP Debug Mode 0 Problem in IE – Page Redirect Problem / Issue
Don’t make debug mode to 0 (zero) because there is a bug in this mode which you run you application in IE 8. Your page will be redirect again and again. Keep debug level above 0. Have look at the following code. APP -> CONFIG -> CORE.PHP 1 2 3 4 5 6 7 8...
-
Aug 29, 2011
Comments OffThe end of CakePHP?
Today, Nate Abele, lead developer of CakePHP, announced in a cryptic tweet that he leaves the project. This comes shortly after Gwoo, the project manager, left the project, too. It seems like they started to work on a fork of Cake3 called “Lithiumâ€. On Twitter people are a bit puzzled about those events, some even...