views:

689

answers:

2

Hi folks. I've just installed Aptana 2.0, and I'm trying to get Code Assist for Codeigniter. I've never used an IDE before, always stick with my good ol' E-text (Windows version for TextMate). But in every screencast about CodeIgniter, people use Aptana and get benefits of it's awesome Code Assist.

So...any tips for setting it up??

Thanks

A: 

Here is one for autocomplete

http://forums.aptana.com/viewtopic.php?f=14&t=8519

Tom Schlick
+1  A: 

Aptana autocomplete feature for php's build-in function and custom functions in your project is working out of the box. Just type the part of function name, and then press Ctrl+Space. A list of functions will displayed, and if there are only 1 function with that name, the full function name will automatically written.

However, since CI load the library and model using $this->load() method, Aptana will not recognize the methods in the library and models. To make Aptana recognize library's and model's methods, add these comments:

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 *
 * @author donny
 * @property CI_Loader $load
 * @property CI_Input $input
 * @property CI_Output $output
 * @property CI_Email $email
 * @property CI_Form_validation $form_validation
 * @property CI_URI $uri
 * @property Firephp $firephp
 * @property ADOConnection $adodb
 * @property Content_model $content_model
 */
class Content extends MY_Controller {

  function Content()
  {
    parent::MY_Controller();
    //load model
    $this->load->model('content_model');
    //...
  }

  /**
   *
   * @return void
   * @access public
   */
  function index()
  {
    //...
  }

}

In code snipped above, when I type $this->input-> then press Ctrl+Space, a list of methods from Input library will be displayed. The key to do this is the comment with this line:

 * @property CI_Input $input

This will tell Aptana that in my controller, the $this->input-> is actually an object of the CI_Input class. You can do this for models too. Just write the actual class name, and the name inside the controller, and Aptana will recognize and use it, like this:

 * @property Content_model $content_model

I use Aptana and I don't set much. I just set the tab into space with 2 space, install git plugins and jquery support, tweak the shortcut, add php templates that I always use, and I'm ready to go. I try to keep the change minimum, so when I had to use other computer with fresh installed Aptana, I don't have to do re-setting too much. Just do some mandator setting and I can use it right away.

I hope this simple trick work for you.

Donny Kurnia
Thanks Donny, this really helped me! Is there any way to debug CI with Aptana??
fedeisas
There are several way to do debugging. You can install Xdebug http://robsnotebook.com/php_debugger_pdt_xdebug and debug directly from Aptana. My favorite is using firephp http://www.firephp.org/HQ/Use.htm and PHP Quick Profiler http://particletree.com/features/php-quick-profiler/
Donny Kurnia