Posts

Showing posts from 2013

Hostinger | Free Web Hosting with PHP and MySQL, Website Builder, No Ads

Image
New generation of free hosting Forget stereotypes about free web hosting. Hostinger is different. We provide reliable and feature rich hosting with fanatic user support! Our service uptime is 99.9% - thanks to cloud computing technology we utilize. PHP and MySQL Support We support PHP and MySQL without any restrictions. Our PHP engine comes with all features and functions enabled. You can switch to any PHP version in one click and manage databases with phpMyAdmin tool.   No ads or banners on your pages No text links. No annoying pop-ups. No annoying banners. No mandated forum posting. Your web site will be 100 percent ad free forever.   Software auto installer Just with a few clicks you may install Wordpress, Joomla, PrestaShop, phpBB, Drupal and may other scripts. Fully functional and professional looking web site can be setup in minutes.   Easy to use website builder You can now build your site very easy. ...

CakePHP : Updating The Session User Data After Edit

Image
<?php if ( $ this -> User - > save ( $ this -> request -> data ) ) {                  if ( $ this -> request -> data [ 'User' ] [ 'id' ] = = AuthComponent : : User ( 'id' ) ) { //if current logged in user update user session data                    $ this -> Session - > write ( 'Auth.User.first_name' , $ this -> request -> data [ 'User' ] [ 'first_name' ] ) ; //updating first_name only                    $ this -> Session - > write ( 'Auth.User.username' , $ this -> request -> data [ 'User' ] [ 'username' ] ) ; //updating username only                    $ this -...

CakePHP: Calling Function From Other Controller

Import Controller of the function you want to use. Once you imported  the controller you can call any function of this controller. <?php    //Import controller   App : : import ( 'Controller' , 'SmsOutgoings' ) ;    class ReportsController extends AppController {           public function add ( ) {           $message = "Notification: New report submitted!" ;         //Instantiation          $SmsOutgoings = new SmsOutgoingsController ;        //Call a method from SmsOutgoingsControllerwith parameter        $SmsOutgoings - > notify_user ( $user_id , $message ) ;      }    } ?>

CakePHP : Load Model From Other Controller

In your Controller were you want to load the model. <?php     App : : import ( 'Controller' ) ;    class ReportsController extends AppController {                 public function other_reports ( ) {            //this will load other model            $ this - > loadModel ( 'OtherModel' ) ;            $otherModels = $ this -> OtherModel - > find ( 'all' ) ;            $ this - > set ( 'otherModels' , $otherModels ) ;      }          } ?>