
Codeigniter is a great framework. Eclipse is a very nice IDE. Why not using them both when writing our own apps ?
After some googling i found a way to get auto-completion with codeigniter on eclipse.
Requirements:
- Xampp : I suggest using xampp lite.
- Codeigniter: Obviously
- Eclipse Helios for PHP Development :
Installing Xampp
I suggest Xampp lite zip version. Once downloaded unzip xampp on c: ( or wherever you want ) and you’ll get a folder named xampp.
Then browse that folder and execute xampp-start. Once it is started open xampp-control and make sure that apache and mysql is working.
If xampp won’t work, please look at the xampp forum for it.
Installing CodeIgniter
Go into c:xampphtdocs and create a new folder called example.com ( or wathever you want ) . Then move the unzipped codeigniter folder inside c:xampphtdocsexample.com .
Now navigate inside the c:xampphtdocsexample.comsystem folder and move “application” one level above so you’ll have the following situation inside c:xampphtdocsexample.com:
Now please open the index.php file with your favourite editor. And look if the application and system folder variables are correct
In order to check if everything works good you could open your browser and navigate through http://localhost/example.com/ if you don’t get any error then codeigniter and xampp are working correctly.
Installing Eclipse
Installing eclipse is very easy. Just unzip the archive downloaded in the requirements.
Configuring Eclipse in order to work correctly with codeigniter
Create a new Project : File -> New -> PHP Project
The wizard would open. Write CI_CORE on the Project Name field and be sure to make the changes as shown below:
Note: Look at the directory. We are pointing this project on the Codeigniter system folder.
Now click on the Finish button.
Create a new Project : File -> New -> PHP Project
This time, when the wizard opens, write “example.com” on the Project Name Field. Then in the Contents tab use this path:
c:xampphtdocsexample.comapplication
Now we should have 2 projects:
- CI_CORE
- example.com
Now you can see you’ll get autocompletion for almost all things except for the most used
.
In order to fix this issue open:
- CI_CORE\codeigniter\Base4.php file if you are going to develop under PHP5
- CI_CORE\codeigniter\Base5.php if you’re going to develop under PHP4
Note: Yes open Base4 if you’re using PHP5
If you’re using Base4.php Insert the following code just 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;
Well, Now you’ll get eclipse+codeigniter working with some cool things like auto-completion ![]()
BB
giugno 25, 2010 at 9:35 am
Wow this is great!
made 02 projects as suggested in the post.. and then pasted the following code before constructor in base4.php..
thanks a lot…it is working with eclipse PDT
giugno 25, 2010 at 2:49 pm
I’m happy to know i helped you out
luglio 11, 2010 at 12:04 pm
webpig浏览器推广演示:采集+群发【自动识别】所有主流网站程序,还可以自己写采集规则)SEO优化推广,博客群发,博客群建,博文群评,博主造星,Email群发,论坛群发,论坛短消息群发,SEO回复流量刷,多人顶贴,博客留言踩,数据挖掘,所有草根级推广工具。其他站长功能正在不断开发,有需求请浏览官方论坛 bbs.webpig.org
luglio 15, 2010 at 11:19 am
Super site! Your style is so refreshing in comparison to most other bloggers. Thank you for writing when you get the chance to, I’ll be sure to keep visiting!
luglio 22, 2010 at 7:11 pm
this really works for me. can i load all methods of model? how??
luglio 22, 2010 at 7:17 pm
Simply write the models on the Base4 following the schema shown above
Everything works fine then..
I’m currently working to have a better way to accomplish this
luglio 23, 2010 at 2:42 am
of course i already did that but didn’t work for me..models methods are not loading..
Moreover can u tell me how will i run my codeigniter controller in Eclipse PDT?
agosto 23, 2010 at 7:13 pm
Basically you can’t run a codeigniter project on eclipse you’ve to load a webtab and refresh it
Btw, i found a better way to achieve this task