Part of the EllisLab Network
   
1 of 2
1
netbeans PHP include path
Posted: 17 October 2008 08:12 AM   [ Ignore ]  
Summer Student
Total Posts:  3
Joined  10-17-2008

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

Profile
 
 
Posted: 17 October 2008 01:33 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  353
Joined  03-31-2007

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

Profile
 
 
Posted: 20 October 2008 12:21 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  3
Joined  10-17-2008

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.

Profile
 
 
Posted: 21 October 2008 10:34 AM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  3
Joined  10-17-2008

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

Profile
 
 
Posted: 23 January 2009 12:43 AM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  2
Joined  03-14-2007

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.

Profile
 
 
Posted: 23 January 2009 06:38 AM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  11
Joined  09-17-2007

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.

Profile
 
 
Posted: 23 January 2009 07:58 AM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  14
Joined  01-21-2009

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?

 Signature 

Even with broken wings there is a way to fly

Sex is like Hacking . You get in, you get out, then you hope that you didn’t leave something behind that can be traced back to you.

I appologize for my, sometimes, bad english. Keeping learning! wink

Profile
 
 
Posted: 23 January 2009 08:57 AM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  11
Joined  09-17-2007

See here, with screenshot of code completion
http://www.mybelovedphp.com/2009/01/23/netbeans-revisited-code-completion-for-code-igniter/

Profile
 
 
Posted: 23 January 2009 09:11 AM   [ Ignore ]   [ # 8 ]  
Grad Student
Rank
Total Posts:  40
Joined  12-10-2008

Wow, thanks a lot yudi_set ...

Profile
 
 
Posted: 23 January 2009 10:05 AM   [ Ignore ]   [ # 9 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4839
Joined  07-14-2006

MyBelovedPHP great tips!

Profile
 
 
Posted: 27 January 2009 02:06 AM   [ Ignore ]   [ # 10 ]  
Summer Student
Total Posts:  2
Joined  03-14-2007

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.

Profile
 
 
Posted: 18 June 2009 05:18 AM   [ Ignore ]   [ # 11 ]  
Summer Student
Total Posts:  15
Joined  03-21-2009

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?

Image Attachments
nbeans.png
Click thumbnail to see full-size image
Profile
 
 
Posted: 18 June 2009 08:57 AM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  732
Joined  03-10-2009

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

 Signature 

Code Igniter v1.7.1 Userguide in PDF by squarebones | CI session issues in IE | LAMP + Netbeans

Profile
 
 
Posted: 31 August 2009 11:03 PM   [ Ignore ]   [ # 13 ]  
Summer Student
Total Posts:  7
Joined  04-02-2008

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 ?

Profile
 
 
Posted: 01 September 2009 02:13 AM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  732
Joined  03-10-2009

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/

 Signature 

Code Igniter v1.7.1 Userguide in PDF by squarebones | CI session issues in IE | LAMP + Netbeans

Profile
 
 
Posted: 04 September 2009 12:06 AM   [ Ignore ]   [ # 15 ]  
Summer Student
Total Posts:  7
Joined  04-02-2008

Thanks for the reply. I guess netbeans version may be the problem. Now everything seems fine. I also have written a tutorial for simpliciy here http://rhasan.com/blog/2009/09/codeigniter-auto-complete-with-netbeans/

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 721, on January 06, 2010 09:38 AM
Total Registered Members: 115026 Total Logged-in Users: 62
Total Topics: 122461 Total Anonymous Users: 1
Total Replies: 647369 Total Guests: 453
Total Posts: 769830    
Members ( View Memberlist )