EllisLab text mark
Advanced Search
     
Autocomplete CI 2.0 with Netbeans 6.9.1
Posted: 03 February 2011 08:35 AM   [ Ignore ]
Joined: 2009-03-18
3 posts

hi, i was using autocomplete with CI 1.7.3, but now I upgraded to CI 2.0 and it’s getting some errors with variable $this, in all my Controllers (http://rhasan.com/blog/2009/09/codeigniter-auto-complete-with-netbeans/).

I changed “Controller” to “CI_Controller” and it didn’t worked anymore.

did it happen to you too? any workaround?

c ya thanks.

 
Posted: 03 February 2011 08:48 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2009-03-18
3 posts

ops my mistake. coding problems solved. it worked again.

 
Posted: 03 February 2011 07:08 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2011-02-03
2 posts
luciobrigido - 03 February 2011 01:48 PM

ops my mistake. coding problems solved. it worked again.

How did you manage the autocomplete ?
I got NetBeans 7 and CI_2.0, i placed the file described at the webpage you linked inside nbproject folder of my project…
at the “Tools-> Options-> PHP-> General” my Global include path it’s set to point at the location of the CodeIgniter root folder.
(i also got one to point at codeigniter/system)

Still.. when i type, let’s say:
$this->load->... i dont get the “hints” pop-up at all… even when i press
CTRL+Space i get “No Suggestions”..

Ergh.. mind my bad English, it’s not my native language.

 
Posted: 04 February 2011 08:54 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Joined: 2009-03-18
3 posts
Renji NsK - 04 February 2011 12:08 AM
luciobrigido - 03 February 2011 01:48 PM

ops my mistake. coding problems solved. it worked again.

How did you manage the autocomplete ?
I got NetBeans 7 and CI_2.0, i placed the file described at the webpage you linked inside nbproject folder of my project…
at the “Tools-> Options-> PHP-> General” my Global include path it’s set to point at the location of the CodeIgniter root folder.
(i also got one to point at codeigniter/system)

Still.. when i type, let’s say:
$this->load->... i dont get the “hints” pop-up at all… even when i press
CTRL+Space i get “No Suggestions”..

Ergh.. mind my bad English, it’s not my native language.

hi Renji.

this is my configuration:
- netbeans 6.9.1
- CI 2.0
———————
what do i have:
- autocomplete in my controllers (folder: application/controllers)
- autocomplete in my models (folder: application/models)

what i don’t have:
- autocomplete in my views

but if you look at the .php file for autocomplete, it shows you what classes it will accept autocomplete (class CI_Controller {}; and class CI_Model {};). but views don’t extend any classes (I guess), so it can’t make use of such trick.

i have my file named ‘netbeans_ci_code_completion.php’ (but it can have any name) and is posted inside folder ‘nbproject’, along with other files (project.xml, project.properties etc). use Windows Explorer to do this, because Netbeans may add an extra ‘.php’ to your filename!

in my system i have many versions of CI (1.7, 2.0), so I don’t add it to GLOBAL PATH. i just add it to PATH INSIDE PROJECT (‘add path’), so I include ‘codeigniter2.0/application/’ path for each project. this tend to be more work, but I don’t want any problems with different versions!

then restart your Netbeans. this should solve your problem. mine only worked after a Netbeans restart.

hope this helps you, if not please continue msging.

this is my file:

<?php

/**
* @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_Language $language
* @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
*/

class CI_Controller {};

/**
* @property CI_DB_active_record $db
* @property CI_DB_forge $dbforge
* @property CI_Config $config
* @property CI_Loader $load
* @property CI_Session $session
*/

class CI_Model {};


?> 

c ya.

 
Posted: 04 February 2011 01:39 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2011-02-03
2 posts

yay!
I overwriten my own file with the one you posted inside the code
and everything works fine!

Well, it works with NetBeans 6.9.1 but not with NetBeans 7 Beta.
Don’t realy know the reason…

anyways, what was wrong?
the spelling inside the file of the nbproject folder.
i had

class Controler {}
...
...
...
class 
Model {} 

i was missing the CI_ prefix…

Thanks alot mate! smile

 
Posted: 06 February 2011 07:30 AM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-10
3 posts

Many thanks for the auto complete suggestion - it works a treat on Zend Studio 8.

 
Posted: 07 February 2011 11:01 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Joined: 2011-02-07
1 posts

Here’s how to get auto-complete working with NetBeans 6.9.1 and your CI views.  Additionally, this adds some clarification to what your view’s can expect to have with regards to available variables.

Simply insert something like the following at the top of your view:

<?php
/* @var $this CI_Controller */
/* @var $user AwUser */
/* @var $room AwRoom */
?> 

That’s it.  One thing to note is that it doesn’t appear to work to wrap all of your declarations within a single comment.

Enjoy!
Michael

 
Posted: 16 April 2011 03:09 AM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2009-04-23
9 posts

Thanks luciobrigido, helped me a lot.

 Signature 

-
crag

 
Posted: 03 May 2011 12:24 AM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Joined: 2011-05-03
3 posts

I was able to get autocomplete working for Netbeans 7.0 (final) in OSX.  I created the file as stated above, but placed the file in a new empty folder (I named it “autocomplete”) inside nbproject folder.  Then in “File > Project Properties (projectname) > PHP Include Path” I added the newly created folder “autocomplete” path.

 
Posted: 18 July 2011 02:04 AM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Joined: 2010-09-20
9 posts
REK - 03 May 2011 04:24 AM

I was able to get autocomplete working for Netbeans 7.0 (final) in OSX.  I created the file as stated above, but placed the file in a new empty folder (I named it “autocomplete”) inside nbproject folder.  Then in “File > Project Properties (projectname) > PHP Include Path” I added the newly created folder “autocomplete” path.

That. Is. AWESOME.  I always said “welllll, CI is so light that you don’t need completion,” but now I can admit that I was just being stubborn grin

Thanks for this!

 
Posted: 16 August 2011 12:37 PM   [ Ignore ]   [ # 10 ]   [ Rating: 0 ]
Joined: 2011-08-16
1 posts

Between this:

luciobrigido - 04 February 2011 01:54 PM
Renji NsK - 04 February 2011 12:08 AM
luciobrigido - 03 February 2011 01:48 PM

ops my mistake. coding problems solved. it worked again.

How did you manage the autocomplete ?
I got NetBeans 7 and CI_2.0, i placed the file described at the webpage you linked inside nbproject folder of my project…
at the “Tools-> Options-> PHP-> General” my Global include path it’s set to point at the location of the CodeIgniter root folder.
(i also got one to point at codeigniter/system)

Still.. when i type, let’s say:
$this->load->... i dont get the “hints” pop-up at all… even when i press
CTRL+Space i get “No Suggestions”..

Ergh.. mind my bad English, it’s not my native language.

hi Renji.

this is my configuration:
- netbeans 6.9.1
- CI 2.0
———————
what do i have:
- autocomplete in my controllers (folder: application/controllers)
- autocomplete in my models (folder: application/models)

what i don’t have:
- autocomplete in my views

but if you look at the .php file for autocomplete, it shows you what classes it will accept autocomplete (class CI_Controller {}; and class CI_Model {};). but views don’t extend any classes (I guess), so it can’t make use of such trick.

i have my file named ‘netbeans_ci_code_completion.php’ (but it can have any name) and is posted inside folder ‘nbproject’, along with other files (project.xml, project.properties etc). use Windows Explorer to do this, because Netbeans may add an extra ‘.php’ to your filename!

in my system i have many versions of CI (1.7, 2.0), so I don’t add it to GLOBAL PATH. i just add it to PATH INSIDE PROJECT (‘add path’), so I include ‘codeigniter2.0/application/’ path for each project. this tend to be more work, but I don’t want any problems with different versions!

then restart your Netbeans. this should solve your problem. mine only worked after a Netbeans restart.

hope this helps you, if not please continue msging.

this is my file:

<?php

/**
* @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_Language $language
* @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
*/

class CI_Controller {};

/**
* @property CI_DB_active_record $db
* @property CI_DB_forge $dbforge
* @property CI_Config $config
* @property CI_Loader $load
* @property CI_Session $session
*/

class CI_Model {};


?> 

c ya.

This:

REK - 03 May 2011 04:24 AM

I was able to get autocomplete working for Netbeans 7.0 (final) in OSX.  I created the file as stated above, but placed the file in a new empty folder (I named it “autocomplete”) inside nbproject folder.  Then in “File > Project Properties (projectname) > PHP Include Path” I added the newly created folder “autocomplete” path.

And This:

msacket - 08 February 2011 04:01 AM

Here’s how to get auto-complete working with NetBeans 6.9.1 and your CI views.  Additionally, this adds some clarification to what your view’s can expect to have with regards to available variables.

Simply insert something like the following at the top of your view:

<?php
/* @var $this CI_Controller */
/* @var $user AwUser */
/* @var $room AwRoom */
?> 

That’s it.  One thing to note is that it doesn’t appear to work to wrap all of your declarations within a single comment.

Enjoy!
Michael

It’s never been better - running NB 7.0.1 on Mac OS 10.7

Thanks for the input people!

 
Posted: 27 September 2011 06:26 AM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2011-07-13
15 posts
luciobrigido - 04 February 2011 08:54 AM
Renji NsK - 04 February 2011 12:08 AM
luciobrigido - 03 February 2011 01:48 PM

ops my mistake. coding problems solved. it worked again.

How did you manage the autocomplete ?
I got NetBeans 7 and CI_2.0, i placed the file described at the webpage you linked inside nbproject folder of my project…
at the “Tools-> Options-> PHP-> General” my Global include path it’s set to point at the location of the CodeIgniter root folder.
(i also got one to point at codeigniter/system)

Still.. when i type, let’s say:
$this->load->... i dont get the “hints” pop-up at all… even when i press
CTRL+Space i get “No Suggestions”..

Ergh.. mind my bad English, it’s not my native language.

hi Renji.

this is my configuration:
- netbeans 6.9.1
- CI 2.0
———————
what do i have:
- autocomplete in my controllers (folder: application/controllers)
- autocomplete in my models (folder: application/models)

what i don’t have:
- autocomplete in my views

but if you look at the .php file for autocomplete, it shows you what classes it will accept autocomplete (class CI_Controller {}; and class CI_Model {};). but views don’t extend any classes (I guess), so it can’t make use of such trick.

i have my file named ‘netbeans_ci_code_completion.php’ (but it can have any name) and is posted inside folder ‘nbproject’, along with other files (project.xml, project.properties etc). use Windows Explorer to do this, because Netbeans may add an extra ‘.php’ to your filename!

in my system i have many versions of CI (1.7, 2.0), so I don’t add it to GLOBAL PATH. i just add it to PATH INSIDE PROJECT (‘add path’), so I include ‘codeigniter2.0/application/’ path for each project. this tend to be more work, but I don’t want any problems with different versions!

then restart your Netbeans. this should solve your problem. mine only worked after a Netbeans restart.

hope this helps you, if not please continue msging.

this is my file:

<?php

/**
* @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_Language $language
* @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
*/

class CI_Controller {};

/**
* @property CI_DB_active_record $db
* @property CI_DB_forge $dbforge
* @property CI_Config $config
* @property CI_Loader $load
* @property CI_Session $session
*/

class CI_Model {};


?> 

c ya.

worked great for me too on osx lion, gonna try it on win 7 too. thanks you very much.

 Signature 

I love CI !

Send E-mails with Gmail Account:
https://github.com/sineld/CI-Gmail

 
Posted: 28 October 2012 05:37 PM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Joined: 2012-10-28
1 posts

Hi, I just started using CI 2.1.3 and Netbeans 7.2.1. After following the suggested approach I have the autocomplete working on all CI classes. However, it is still not working for classes I derive from CI such as my own controllers, modules, etc. I added some lines to the autocomplete.php to include the new classes to no avail. Below an example of what I added to the autocomplete.php:

* @property ND_user_module $user

So now $this-> includes the ND_user_module user class in the autocomplete but $this->user does not include any of the properties and methods of the ND_user_module class.

What am I doing wrong?

Thanks in advance.