ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

netbeans PHP include path

October 17, 2008 11:12am

Subscribe [15]
  • #1 / Oct 17, 2008 11:12am

    erolyildiz

    2 posts

    Hi,

    I am using codeigniter with netbeans and would like to use code completion for codeigniter classes. I added all of the codeigniter folders under system folder to the PHP include path but code completion works partly. For example it can’t complete $this->load() function for a class extending Controller class.

    Shall I include other things to have a full code completion?

    Thanks.


    Erol

  • #2 / Oct 17, 2008 4:33pm

    manilodisan

    223 posts

    I doubt you will have full code completion in PHP frameworks with netbeans. You should try phpdesigner or Zend.

  • #3 / Oct 20, 2008 3:21am

    erolyildiz

    2 posts

    I tried a version of eclipse which has PDT and a debugger offered in zend side and it can’t do completion fully too. Again it can’t complete $this->load function etc.

  • #4 / Oct 21, 2008 1:34pm

    erolyildiz

    2 posts

    I tried eclipse with PDT, easyeclipse php version, netbeans and komodo for auto completion and just komodo can do fully completion. None of the other editors can comeplete $this->load function but komodo can.


    Erol

  • #5 / Jan 23, 2009 2:43am

    yudi_set

    2 posts

    Hi,

    I’m a newbie to PHP and CodeIginiter.
    Code-completion is something that really helps me when learning CodeIgniter.

    I just read an article on NB4PHP developer blog (http://blogs.sun.com/netbeansphp/entry/fwd_model_based_code_insight).
    It refers to an article written for CakePHP.
    But the principles apply to CodeIginter, too.

    For example, I put it this way in a contoller :
    <?php
    /**
    * @property CI_Loader $load
    * @property CI_Form_validation $form_validation
    * @property CI_Input $input
    * @property CI_Email $email
    *
    */
    class Form extends Controller
    {
    function index()
    {
    $this->load->helper(array('date','form'));
    $this->load->library(array('email','form_validation'));

    //Validaton rules
    $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
    $this->form_validation->set_rules('member_no','Member Number','trim|required|numeric');
    ....
    }
    }

    So, when we type $this-> it will offer load in the code-completion.
    And when we type $this->load-> will offer all functions from the CI_Loader class.

    Hope the info helps.

  • #6 / Jan 23, 2009 8:38am

    MyBelovedPHP

    6 posts

    Thx, very good tip.
    Netbeans is cool, another very useful one to add

    * @property CI_DB_active_record $db

    Now were getting code completion on

    $this>db>...

    One I use the most.

  • #7 / Jan 23, 2009 9:58am

    drale2k

    10 posts

    That sounds really nice. At the moment i am using Dreamweaver CS4 for all my Stuff becouse i got a cheap student license.

    But i am thinking of using some other editor just for PHP. Does Eclipse rock?

  • #8 / Jan 23, 2009 10:57am

    MyBelovedPHP

    6 posts

  • #9 / Jan 23, 2009 11:11am

    PermanaJ

    33 posts

    Wow, thanks a lot yudi_set ...

  • #10 / Jan 23, 2009 12:05pm

    xwero

    4145 posts

    MyBelovedPHP great tips!

  • #11 / Jan 27, 2009 4:06am

    yudi_set

    2 posts

    Thanks for the comment, MyBelovedPHP
    Also for a nice article on your blog, very useful.

    Just to add some more info for others.
    As shared by MyBelovedPHP, we can customize the Class property variables in the Comment to our need.
    Netbeans for PHP also helps us in the process of typing it.

    1. Type /** enter
    2. It will display the comment block
      /**
      *
      */
    3. Then we can start defining the class property that we’re gonna use.
      Eq:
      /**
      * @property CI_ // press CTRL-SPACE and will display all the CI classes
      */
    4. Just for example, we want to use some functions from the email class
      ..
      * @property CI_Email $email
      ...

    Hope this info helps.
    Thank you.

  • #12 / Jun 18, 2009 8:18am

    Oblique

    32 posts

    Hello

    In my app i’ve created file with properties like described here:
    How to enable code completion in NetBeans for CI

    I put my file (autocompletion.php) in nbproject folder, and in this file CC works fine. But in other project files CC doesn’t work even if i put @properties in it.

    Take a look at project structure: i’ve removed “application” folder from “system” folder, so they both are located in “www”

    Any suggestions?

  • #13 / Jun 18, 2009 11:57am

    n0xie

    1381 posts

    For the load function just add:

    @property CI_Loader $load

    If you want to be able to autocomplete models, just add them as well. In my example I’ve loaded a library called ‘Auth’, which has several methods available as you can see.

    @property Auth $auth

    Obviously you want to generate these, which you can do easily within Netbeans.
    http://img269.imageshack.us/img269/1769/screenshotnetbeanside65.th.png
    http://img196.imageshack.us/img196/1769/screenshotnetbeanside65.th.png

  • #14 / Sep 01, 2009 2:03am

    rhasan

    5 posts

    Hi I followed the process mentioned by BelovedPHP. But I am facing a problem. If my project is already open $this->db->… etc does not work. if i restart the netbeans then it works. now after the restart, in another file if i write the

    @property CI_Loader $load…etc

    code it does not work. I have to restart netbeans again to get it working :(
    So I have to restart each time i write the @properties in a new file….Can you please give me a solution. I am using netbeans 6.5

    In short, do I need to restart netbeans each time I add @properties…...etc in controller/model ?

  • #15 / Sep 01, 2009 5:13am

    n0xie

    1381 posts

    Hmmm it works fine here. The only difference I can think of is that I run the 6.7 Linux version.

    Did you add this to your model?

    /**
     *
     * @property CI_DB_active_record $db
     */

    You could try to add the line and then re-open the file and see if that works.
    http://img238.imageshack.us/i/screenshotnetbeanside67.png/

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases