I want to use Zend Studio for a project built on CodeIgniter. But I want to be able to use the debugging functionality of Zend. Because of that, I cant seem to get the debugger to work properly cause it doesnt "understand" codeigniter. So, in order for the setup to work, do I need to install Zend server, so that the debugging is done serverside? Can someone expl开发者_如何学Cain this to me a bit? Thank you.
As Iraklis said, the forum had the answer, to save people some extra searching, here's what worked for me:
Step 1
add:
<?php
class CI_Controller {
/**
*
* @var CI_DB_active_record
*/
public $db;
/**
*
* @var CI_Loader
*/
public $load;
/**
*
* @var CI_Output
*/
public $output;
/**
*
* @var CI_Email
*/
public $email;
/**
*
* @var CI_Session
*/
public $session;
/**
*
* @var CI_Config
*/
public $config;
/**
*
* @var CI_Benchmark
*/
public $benchmark;
/**
*
* @var CI_Calendar
*/
public $calendar;
/**
*
* @var CI_Cart
*/
public $cart;
/**
*
* @var CI_Encrypt
*/
public $encrypt;
/**
*
* @var CI_Upload
*/
public $upload;
/**
*
* @var CI_Form_validation
*/
public $form_validation;
/**
*
* @var CI_FTP
*/
public $ftp;
/**
*
* @var CI_Table
*/
public $table;
/**
*
* @var CI_Image_lib
*/
public $image_lib;
/**
*
* @var CI_Input
*/
public $input;
/**
*
* @var CI_Language
*/
public $lang;
/**
*
* @var CI_Pagination
*/
public $pagination;
/**
*
* @var CI_Trackback
*/
public $trackback;
/**
*
* @var CI_Parser
*/
public $parser;
/**
*
* @var CI_Typography
*/
public $typography;
/**
*
* @var CI_Unit_test
*/
public $unit;
/**
*
* @var CI_URI
*/
public $uri;
/**
*
* @var CI_User_agent
*/
public $agent;
/**
*
* @var CI_Xmlrpcs
*/
public $xmlrpcs;
/**
*
* @var CI_Xmlrpc
*/
public $xmlrpc;
/**
*
* @var CI_Zip
*/
public $zip;
}
and
<?php
/**
*
* Enter description here ...
* @return CI_Controller
*/
function get_instance()
{
}
into files included by your project (create a new file for each just to be safe and make sure it's included in build path)
Step 2
Rebuild to make sure eclipse/zend is aware of the change.
The inconvenient truth:
Unfortunately this won't work for views variables, only for $this->
calls, because Codeigniter uses arrays
to store variable names
, so eclipse/zend would need to be running the code in order to see them. And to make things even harder to detect automatically, this is done cross-file and the filename is set using a variable.
here is one example:
in views/controllers/file.php you put:
$data['foo']='foo text';
$this->load->view("foo",$data); //"foo" is the filename without the .php extension
in views/foo.php you get:
echo $foo;
//outputs: "foo text"
But this is just the way codeigniter works.
source: https://github.com/scoumbourdis/codeigniter-autocomplete/tree/master/application/libraries/fake
full tutorial: http://www.web-and-development.com/codeigniter-and-eclipse-autocomplete/
I would advise you to search codeigniter's forum. There are a few threads there discussing Zend integration.
精彩评论