0 Comments    Feb 07, 2011

There are quite a few tutorials that will show you how to how to get autocomplete for CodeIgniter 1.7.x but unfortunately the same doesnt apply for CodeIgniter 2.0.  I have however been using a method that allows me to get code-hinting across my controllers and models.

This comes with a warning however.  We will be making some changes to the controller.php and model.php so make sure you backup these 2 files or at the very least have a zipped copy of CodeIgniter handy in case things go awry.

If you have your codeigniter app ready, navigate to your system folder and open up controller.php and model.php in the core directory. Copy the lines below and paste them in each file. Most likely before the start of the class declaration.

 

 

/**
   * @property CI_DB_active_record $db
   * @property CI_DB_forge $dbforge
   * @property CI_Benchmark $benchmark
   * @property CI_Calendar $calendar
   * @property CI_Cart $cart
   * @property CI_Config $config
   * @property CI_Controller $controller
   * @property CI_Email $email
   * @property CI_Encrypt $encrypt
   * @property CI_Exceptions $exceptions
   * @property CI_Form_validation $form_validation
   * @property CI_Ftp $ftp
   * @property CI_Hooks $hooks
   * @property CI_Image_lib $image_lib
   * @property CI_Input $input
   * @property CI_Lang $lang
   * @property CI_Loader $load
   * @property CI_Log $log
   * @property CI_Model $model
   * @property CI_Output $output
   * @property CI_Pagination $pagination
   * @property CI_Parser $parser
   * @property CI_Profiler $profiler
   * @property CI_Router $router
   * @property CI_Session $session
   * @property CI_Sha1 $sha1
   * @property CI_Table $table
   * @property CI_Trackback $trackback
   * @property CI_Typography $typography
   * @property CI_Unit_test $unit_test
   * @property CI_Upload $upload
   * @property CI_URI $uri
   * @property CI_User_agent $user_agent
   * @property CI_Validation $validation
   * @property CI_Xmlrpc $xmlrpc
   * @property CI_Xmlrpcs $xmlrpcs
   * @property CI_Zip $zip
   * @property CI_Javascript $javascript
   * @property CI_Jquery $jquery
   * @property CI_Utf8 $utf8
   * @property CI_Security $security
*/

Now create a new file in your application's core folder and extend CI_Controller.  Call the file MY_Controller.  Now try using accessing any of the CodeIgniter libraries.  You should get code autocomplete for them.  Even if you decide to extend MY_Controller, you will still get codehinting.  The same applies to extending CI_Model.  I am not sure if this method works with other IDE

 
 Filed In: CodeIgniter




Other Posts You Might Like


blog comments powered by Disqus