Thursday, July 15, 2010

using codeigniter autocomplete in eclipse helios

UPDATE FOR CODEIGNITER 2


Paste the codes in /system/core/controller.php and /system/core/model.php instead.


I was able to get my eclipse autocomplete for codeignite in these two steps.

I use eclipse helios and codeigniter 1.7.2 and php5
  1. Create a new eclipse php project, choose project at existing location and choose path/to/codeigniter/system. I mean path to the codeigniter folder.
  2. edit codeigniter/Base4.php
    and insert the following before the constructor
            /**
    * @var CI_Config
    */
    var $config;
    /**
    * @var CI_DB_active_record
    */
    var $db;
    /**
    * @var CI_Email
    */
    var $email;
    /**
    * @var CI_Form_validation
    */
    var $form_validation;
    /**
    * @var CI_Input
    */
    var $input;
    /**
    * @var CI_Loader
    */
    var $load;
    /**
    * @var CI_Router
    */
    var $router;
    /**
    * @var CI_Session
    */
    var $session;
    /**
    * @var CI_Table
    */
    var $table;
    /**
    * @var CI_Unit_test
    */
    var $unit;
    /**
    * @var CI_URI
    */
    var $uri;
    /**
    * @var CI_Pagination
    */
    var $pagination;

Save it and you're done. Try using the autocomplete and if it doesn't show, force it by pressing Ctrl-Space.

8 comments:

  1. Hi,

    Can you please explain to me how to integrate the auto-completion with CodeIgniter 2.0.1.

    Thanks in advance.

    ReplyDelete
  2. Hi, how to implement this in codeigniter with HMVC pathern?
    Thanks.

    ReplyDelete
  3. For auto-completion HMVC pattern insert above code of this article in file Controller.php in your application/third_party/MX folder inside of class MX_Controller. Then $this->load->view,model worked if your inherit your controller from MX_Controller!

    ReplyDelete
  4. More simple method: create in the project root folder ex. autocomplete and in this folder create file controller.php with content
    <?php

    class MX_Controller {

    /**
    * @var CI_Config
    */
    var $config;
    /**
    * @var CI_DB_active_record
    */
    var $db;
    /**
    * @var CI_Email
    */
    var $email;
    /**
    * @var CI_Form_validation
    */
    var $form_validation;
    /**
    * @var CI_Input
    */
    var $input;
    /**
    * @var CI_Loader
    */
    var $load;
    /**
    * @var CI_Router
    */
    var $router;
    /**
    * @var CI_Session
    */
    var $session;
    /**
    * @var CI_Table
    */
    var $table;
    /**
    * @var CI_Unit_test
    */
    var $unit;
    /**
    * @var CI_URI
    */
    var $uri;
    /**
    * @var CI_Pagination
    */
    var $pagination;

    }

    It's all, autocompletion Codeigniter with HMVC pattern work!

    ReplyDelete
  5. Thanks! works like a charm

    ReplyDelete
  6. Here's a really great way to do it with netbeans 7, codeigniter 2.* and HMVC .. read comments I put in the file http://pastebin.com/Qq60nENj

    ReplyDelete