eclipsecodeigniter_ide

Working with Eclipse and Code Igniter


eclipsecodeigniter_ideTill recently I had been using my trusted editor, Notepad++, for doing all my development work. Not that I am not using it anymore, but I was looking for something more powerful and integrated, something like an IDE. I had tried few IDEs including Eclipse before but did not get much into it and hence left it there. I picked up Eclipse again and tried to give it one more try. I also tried out Aptana which is another awesome IDE built on Eclipse with all the web development tools you need built into it out-of-box (PHP, Ruby, jQuery, Python).

So, I started with downloading PHP Development Tools Project version of Eclipse (Eclipse PDT) as I was primarily going to use it for PHP development. Its a huge zip file but good thing is no need to install it, just unzip and run the exe. After setting up the initial workspace, PHP settings etc., we can start adding our projects and get onto development work.

Currently, the project I am working on is built using Code Igniter and was looking to develop using Eclipse. Adding a project was pretty straight forward but getting the auto completion to work was an issue. However, there is a workaround to get it all working.

First, we need to move the application folder out of the system folder and bring it up one level next to the system folder. So, it looks something like this :

application/
	config/
	controller/
	errors/
	....
system/
	codeigniter/
	database/
	fonts/
	.....
index.php
.htaccess

Now, edit the index.php file in the root folder and change the following line :


$application_folder = "application";

to

$application_folder = "../application";

eclipsecodeigniter_ide

eclipsecodeigniter_projectsviewNow, we can add the system and application folders as Eclipse project. First create a new project and name it something like “CI_CORE” which points to the system folder. Similarly, add another project “CI_APP” which points to the application folder. It should look something like the following image. Once, CI_APP is added, right click and modify the properties. Select PHP Include Path and add “CI_CORE” under Projects. And it’s done.

Now, to test out whether the auto completion feature works or not, create a new controller (news.php in my example) and add constructor method. Add any method and press Ctrl + Space to bring the auto completion window like the following image.

eclipsecodeigniter_autocompletion

Happy Coding!!!

About these ads

34 comments

  1. is there any tutorial about this?? i downloaded already eclipse+pdt..but i dont know how to integrate with CodeIgniter.. im using XAMPP and Dreamweaver CS3..want to learn new things..please post it …

    1. Kahtrina,
      You need to download and unzip CodeIgniter code in the XAMPP htdocs folder. That is the document root from where your site will be served. Once that is done, you need to follow the post above and it should work.

      1. i have already put my Codeigniter in the XAMPP htdocs. What i don’t know is how can i make it run with eclipse + pdt?? is there any configuration i needed??

  2. Thanks a lot.
    How you setup debugger in Eclipse PDT for CodeIgniter?
    I hope you can help me. Thanks in advance

    I use XAMPP and my Zend Debugger works in my non-codeigniter applications. I have learned CodeIgniter for ten days.

  3. i know how codeigniter works in XAMPP.. how can i code my codeigniter project using eclipse + pdt as my editor like dreamweaver cs3? that’s what i want to learn.. can you post tutorial bout that?? thanks in advance.. :-)

  4. Hi, I just followed you method. It works anyway, but the auto completion doesn’t work. Do I need change the debugger ? Thanks.

    1. I did not change the debugger. If everything is setup correctly, the auto completion works fine. Try it and let me know.

  5. Thanks, I’ve been stuck in doing my final-project. This is really helpful. I think the point is in pointing application folder and system folder. :)

  6. Hello:)
    I have a problem.Actually, I got the same structure CI_CORE,CI_APP,and select the include path as well. But the feature of auto-complement still no happens.
    Does it need more configuration?

  7. Hi! Nice tip! …

    but… I’ve followed your instructions and I can’t get the autocomplete only for ‘load’ (and ‘view’) when $this->load…

    I have the PHP Eclipse + PDT Edition and CI 1.7.2

    “No completions available” :( … How can I fix this?

    Regards

    sorry for my english :P

    1. Benita,
      When you create a new project, the wizard should ask you where it should point to. Name it as CI_CORE and point that to the system folder.

  8. Hey friends,
    I’m new to eclipse and codeigniter can any one plz explain how to use eclipse to develop in code igniter folder ?
    do i have to copy system folder from codeigniter into every project i create ?

  9. Thank you a bunch for sharing this with all of us you really know what you’re speaking about! Bookmarked. Please additionally consult with my site =). We could have a hyperlink exchange contract among us

  10. You are so awesome! I don’t believe I’ve read anything like this before.
    So great to find someone with a few genuine thoughts
    on this subject matter. Really.. thank you for starting this
    up. This website is one thing that is needed on the web, someone
    with a little originality!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s