Category Covered

cakephp allow sub directory by htaccess  

I have two project one main project which is running fine but now i want to run another cakephp project on the same domain.
So you are in the write place this tutorial will help you to run a cakephp on a sub domain

1. First you have change the .htaccess on  /httpdocs/ <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteRule    ^$ cake_sub_project/app/webroot/    [L  
By: Tech writer  |   Total Read: 5942  |   Read more..

CakePHP update all with conditions  

If you want to update some conditionals fields on cakephp then hope it will help you.   $this->DoctorSpeciality->updateAll(array("is_default"=>0), array('DoctorSpeciality.user_id'=>$doctor_id, ' !='=>$id));   Here first array "array("is_default"=>0)" is the field and vale you want to update   2nd array is the conditions that you want check before update.  
By: Tech writer  |   Total Read: 1621  |   Read more..

How to change the default url in CakePHP  

How to change the default url in CakePHP

Just go directly to the router.php in your website. Here you need to change the following code:

Router::connect('/', array('controller' => ' contents', 'action' => 'lists'));

Change the controller name and action as you needed. Suppose you want open directly the login page when your website launches….then you just need to change the controller name  
By: mimosa  |   Total Read: 942  |   Read more..

Cakephp count with group by  

Below is the simple example that will show you on  how to use count of value with group by. $todayApps = $this->DoctorAppointment->find('all', array( 'conditions'=>array('DoctorAppointment.appointment_date >='=> $firstDayOfMonth, 'DoctorAppointment.appointment_date <='=> $lastDayOfMonth), 'order'=>array('DoctorAppointment.appointment_date'), 'fields'=>array('DoctorAppointment.appointment_date', 'COUNT(`Doc  
By: Tech writer  |   Total Read: 1880  |   Read more..

Cakephp form action  

To set or change cakephp form action you just follow the below example echo $form->create('Comment', array('url' => array('controller' => 'comments', 'action' => 'actionName'));  
By: Tech writer  |   Total Read: 777  |   Read more..

CakePHP session read write  

You can write into session in cakephp by using the following statement $this->Session->write('Booking.docId', $this->params['pass']['1']); You can read into session in cakephp by using the following statement $this->Session->read('Booking.docId'); You can also use the normal session that you used to PHP like $_SESSION  
By: Tech writer  |   Total Read: 726  |   Read more..

Cakephp conditions on association table  

How do i set conditions on cakephp associated tables. This is needed if you have some model and when you are doing query and want to set condition on the associated table. Here i have three models User/Doctor, DoctorSchedule and DoctorScheduleTimeblock, Main Model DoctorSchedule, Here add the behavior on your model   class Post extends AppModel { var $actsAs = array('Containable'); }   You can also attach the behavior on t  
By: Tech writer  |   Total Read: 805  |   Read more..

How to Create HTML Links in CakePHP  

How to Create HTML Text Links in CakePHP
<?php echo $html->link(My Text', 'URL'); ?> 
How to create an external link in Cakephp
  <?php echo $html->link('CakeBook', ''); ?>
Now if you want to include a css on that link you can edit the code like- <div><?php echo $html->link('CakeBook', 'http://', array('class'=>myclass)); ?><  
By: mimosa  |   Total Read: 2277  |   Read more..

Cakephp cache on query  

To implement cache on find query or on other query just follow the step. At first edit core.php and add the following code Cache::config('longterm', array(    'engine' => 'File',    'duration' => '+1 week',    'probability' => 100,    'path' => CACHE . 'longterm' . DS, )); You can add duration on several things like +1 week, +1 hours, +30 days etc.   Now its time to implement c  
By: Tech writer  |   Total Read: 684  |   Read more..

Cakephp not equal condition  

Here is the example of cakephp not equal conditions   array('User.group_id !='=>'18')  
By: Tech writer  |   Total Read: 3202  |   Read more..
Top 15 Posts