Codeigniter is a great framework for php . It is simple and already helps lot of people to write faster code. The documentation is very good with examples for all the classes – functions.
But (there is always a but…!) in eclipse we used to have our own classes and when we write the “magic arrow” -> we are waiting to have a dropdown list with the functions/variables that the class have .
In Codeigniter till now we write for example $this->session-> … and then we go to the codeigiter website just to see what was the name of the function .
For that reason I created a fake Controller. This is only a fake Controller and it used ONLY for the autocomplete. You can copy paste it WHEREVER you like in the project (because is fake).
Ok lets see it how it works .
1st Step
Download the zip file :
Download the zip file for CI 2.X and CI 3.X (recommended)
or
Download the zip file for CI 1.7.x
or
Download the latest development edition from github repository: https://github.com/scoumbourdis/codeigniter-autocomplete
2nd Step
Copy it somewhere in your project (I’ve copy it into libraries in a folder named fake)
3rd Step
Start typing in your Controller :-). That’s it. Pretty easy right? Below there are some images to show what you are be able to do.
Marco
Not work 🙁
Admin
Hello Marco and thank you for your post. Make sure:
1. that you work in eclipe.
2. If it doesn't work refresh your project and then try again.
3. If again it doesn't work (that is really rare!!!) go to the system->libraries->Controller right click ->Built Path and then go to Exclude (as I show you in the image)
4. If again it doesn't work make sure your class extends Controller for example:
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
}
function index()
{
$this->load->view('welcome_message');
}
}
/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */
André
if you're using CI 2.0 just rename Controller to CI_Controller and autocomplete will work
web_and_development
Thanks Andre I didn't know that
Adacho5
hi it doesn't work in my project. I make points:
1. that you work in eclipe.
2. If it doesn't work refresh your project and then try again.
but the 3 i cant find. I worh with CI 2.0 my controler.php is in system/core/controler.pho when I Right mouse click i have Built Path but it shows sub menu Configure bulid path… and then What would I do?
admin
You can download the files for CI 2.0 from this url – http://www.web-and-development.com/downloads/fakeController_CI_2.0.zip. I just updated my post so you can download it from there. Hope it helps
web_and_development
You can download the files for CI 2.0 from this url – http://www.web-and-development.com/downloads/fakeController_CI_2.0.zip. I just updated my post so you can download it from there. Hope it helps
alan michel
This also works for Netbeans 🙂
thnx for sharing
ofuenzalida
netbeans??'
web_and_development
Yeap NetBeans for PHP
Tim
Thank you!
Decroffie
Thanks for the library idea.
Afezer
Thanks a lot. It is very helpful. But it doesn’t work in models. Probably people who say not work tried in a model. To make work in a model;
+ Copy fake_controller.php and paste same directory.
+ Rename it fake_model.php
+ Rename class name from CI_Controllers to CI_Model.
Damiano Venturin
that’s a nice work! thank you!
Damiano Venturin
I’m going to add this in all my projects
ciao!
porquero
Good Job!
Daniel
Great, thanks a lot!
kootsoop
Great post, thanks!
The autocompletion now works, but I still can’t get “Open Declaration F3” to work… even on methods that show up in the autocompletion. Do you have any suggestions?
Also, when I load models
$this -> load -> model(‘my_model’);Autocompletion doesn’t show up $this -> my_model (or anything that is part of my_model with an extra ->). Again, any pointers you might have greatly appreciated!
mehmet soylu
if you using HMVC thirdy_party system, you should change fake controller class name with probably “MX_controller”.
Thank you for idea.
Zeeshan
It works fine but is there a systematic way to do so, that works with all (or most) other frameworks? I have my custom MVC framework which netbeans understands well but eclipse is dead for that framework too.
The method you have used is just like pushing eclipse to include the specified things. It is still not able to load the libraries on its own.
Dilip
hi i download this but can not extract it… can you plz help me..
thanks
web_and_development
Try to download it from my github repository
https://github.com/scoumbourdis/codeigniter-autocomplete/archive/master.zip
engrmudasirmalik
this is kind of very awesome 🙂
Stefan Rogin
Great job, thanks! Eclipse found 3 duplicate entries in the file ($image_lib,$form_validation,$lang) is there any reason for them ?
web_and_development
Yes you are right. I just forgot to renew the zip file. Now it looks better 😉
Thanks
Carnevalli
It works fine!! Thanks for sharing
Максаров Михаил
CI_Router is missing
web_and_development
Even though it is at the $this->router , it is not anywhere documented at the codeigniter user guide so I am not using it.
Vipin Kr. Singh
Could you please explain the logic behind it, I mean how it works. I want to make it work for WordPress.
Firas Abd Alrahman
eclipse detect all classes even if you does not include them with “include” function
freddy
You should provide by demo and tutorial, it help new bie to understand it !
clod
I prefer to use Codelobster for CodeIgniter autocomplete: http://codelobster.com/codeigniter.html
MacWill
Thanks for taking the time to write this. I am going to use it for some projects in the future. Brian
Farhad_H.P.
Hi, Thanks.
Please update it for codeigniter 3.X and 4.X
Very very thank you.
web_and_development
It works just fine with 3.X. I will also check it from 4.X and I will update the post 🙂
Simón
Thanks a lot!
Robert
Why not one for Sublime Text editor? 🙂