Cakephp comes with inbuilt pagination and sorting component and helper which work well in any app. However in order to make data tables ajax driven one might want to look at alternative solutions. One such solution is Cakephp Datatablse Plugin which uses datatables. Continue reading
CakePHP Captcha plugin by me is one of the most used and trusted CakePHP captcha support since 2009. I have maintained CakePHP Captcha support throughout these years and am still committed to maintain it as long others and I found it useful for the users of CakePHP framework. Continue reading
In CakePHP 2 we had hasMany, saveMany, saveAssociated model methods or functions to save associated data. These functions works great with straight associations but to make them work for saving multi-level association data you need a trick. Continue reading
Today I tried to update Cakephp by running php composer update on my server. I tried to follow the commands given at https://getcomposer.org/download/ under Command-line installation but it failed at the very first go. The command line code was: Continue reading
While working in a CakePHP application in my local computer I usually use Gmail SMTP in CakePHP to send emails from my application which are of course test emails. Previously it worked just fine with the basic settings (as specified in first code snippet below) but down the road some times later Continue reading
In CakePHP 2.x we used Router::url() to generate URL in any file. It works almost same with two major differennces though. The first one is that we have to call Router class manually wherever we want to use this function. Continue reading
I got started with my new CakePHP 3.x project today. As usual I wanted to create a few scaffold using
cake bake command. As I already had a CakePHP 2.x setup in my machine. I still needed it and its
cake bake commands to run to create any thing while working on the cakephp 2.x project. So is there a way I could use both cake bake consoles for CakePHP 2.x and 3.x respectively, at the same time?
Answer is YES. All we need to do is make some tweaks in order to run them both. Here are what I did.
- I actually went back into the CakePHP 2.x installation and renamed the cake and cake.bat to cake2 and cake2.bat respectively. There are located in C:\wamp\www\mycakephp2app\lib\Cake\Console.
This step actually was to set path environmental variable manually for CakePHP 3 as I already had set it up for CakePHP 2.x on my windows machine. I actually need them both. So I would add them like this C:\wamp\www\mycakephp2app\bin;C:\wamp\www\mycakephp2app\lib\Cake\Console;(for cakephp 3 it is set automatically.
If you installed Cakephp 2 after CakePHP was installed you have to set the environmental variable path accordingly)
- As you might have noticed that I renamed cake and cake.bat shell scripts to cake2 and cake2.bat respectively I need to run cake2 bake in order to invoke CakePHP baker.
I was making a url route like this:
Router::connect('/ca/assets', array('plugin' => 'file_manager', 'controller' => 'file_manager', 'action' => 'assets', 'ca'));
It worked alright with normal urls as- /ca/assets. However when i used paginator in view as
it generates url as- /assets/ca/page:2
I tried different things and at the end, as a work around to this problem I figured out that the following trick works. So make some heck in the $this->Paginator->options() function as the following:
$this->Paginator->options(array( 'url'=>array('controller' => 'ca', 'controller'=>'action', 'plugin'=>false) ));