zend studio CI 代码提示的方法,自定义类提示

一直苦恼在zend studio下CI (CodeIgniter)的代码没有提示,每次要到对应类里面去找很麻烦,今天终于搞得了,而且可以加上自己写的model类的方法提示,$this->可以出来本类的方法提示,可以点击直接连接到model方法里面去。先上个截图感受下!

ci代码提示方法

 

ci代码提示方法3

 

ci代码提示方法2

是不是发现比没有提示爽太多了?开发效率也应该是成倍的增长了。

注:新版本的system/core/libraries下model和control加入的内容是不一样的了,否则会报错。

另外这两个系统文件 尽量不要更新到生产环境,有可能会影响效率。下面是control里面加入的内容(model的放在后面):

//加入以下代码到CI的Controller和Model类的类申明下
//ci_path/system/core/libraries下:Controller.php
//在类申明下,也就是“class …..{”后插入附件中的代码即可
//注意:自定义的一定要加上前面的注数才可以,加上@var 类名才能出来提示,例如最后面的Usermodel
//————————————————————————
//补善CI在IDE中的代码提示-开始
//————————————————————————
/**
* @var CI_Loader
*/
var $load;
/**
* @var CI_DB_active_record
*/
var $db;
/**
* @var CI_Calendar
*/
var $calendar;
/**
* @var Email
*/
var $email;
/**
* @var CI_Encrypt
*/
var $encrypt;
/**
* @var CI_Ftp
*/
var $ftp;
/**
* @var CI_Hooks
*/
var $hooks;
/**
* @var CI_Image_lib
*/
var $image_lib;
/**
* @var CI_Language
*/
var $language;
/**
* @var CI_Log
*/
var $log;
/**
* @var CI_Output
*/
var $output;
/**
* @var CI_Pagination
*/
var $pagination;
/**
* @var CI_Parser
*/
var $parser;
/**
* @var CI_Session
*/
var $session;
/**
* @var CI_Sha1
*/
var $sha1;
/**
* @var CI_Table
*/
var $table;
/**
* @var CI_Trackback
*/
var $trackback;
/**
* @var CI_Unit_test
*/
var $unit;
/**
* @var CI_Upload
*/
var $upload;
/**
* @var CI_URI
*/
var $uri;
/**
* @var CI_User_agent
*/
var $agent;
/**
* @var CI_Validation
*/
var $validation;
/**
* @var CI_Xmlrpc
*/
var $xmlrpc;
/**
* @var CI_Zip
*/
var $zip;
/**
* @var Usermodel
*/
var $usermodel;
//————————————————————————
//补善CI在IDE中的代码提示—结束
//————————————————————————

 

model的内容(变量声明方式用private 替代var,在__construct里面加入__get):

<?php if ( ! defined(‘BASEPATH’)) exit(‘No direct script access allowed’);
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 – 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/

// ————————————————————————

/**
* CodeIgniter Model Class
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/libraries/config.html
*/
class CI_Model {
//加入以下代码到CI的Controller和Model类的类申明下
//ci_path/system/core/libraries下:Controller.php 和 Model.php 两个文件
//在类申明下,也就是“class …..{”后插入附件中的代码即可
//————————————————————————
//补善CI在IDE中的代码提示-开始
//————————————————————————
/**
* @var CI_Loader
*/
private $load;
/**
* @var CI_DB_active_record
*/
private $db;
/**
* @var CI_Calendar
*/
private $calendar;
/**
* @var Email
*/
private $email;
/**
* @var CI_Encrypt
*/
private $encrypt;
/**
* @var CI_Ftp
*/
private $ftp;
/**
* @var CI_Hooks
*/
private $hooks;
/**
* @var CI_Image_lib
*/
private $image_lib;
/**
* @var CI_Language
*/
private $language;
/**
* @var CI_Log
*/
private $log;
/**
* @var CI_Output
*/
private $output;
/**
* @var CI_Pagination
*/
private $pagination;
/**
* @var CI_Parser
*/
private $parser;
/**
* @var CI_Session
*/
private $session;
/**
* @var CI_Sha1
*/
private $sha1;
/**
* @var CI_Table
*/
private $table;
/**
* @var CI_Trackback
*/
private $trackback;
/**
* @var CI_Unit_test
*/
private $unit;
/**
* @var CI_Upload
*/
private $upload;
/**
* @var CI_URI
*/
private $uri;
/**
* @var CI_User_agent
*/
private $agent;
/**
* @var CI_Validation
*/
private $validation;
/**
* @var CI_Xmlrpc
*/
private $xmlrpc;
/**
* @var CI_Zip
*/
private $zip;
/**
* @var Usermodel
*/
private $usermodel;
//————————————————————————
//补善CI在IDE中的代码提示—结束
//————————————————————————

/**
* Constructor
*
* @access public
*/
function __construct()
{
log_message(‘debug’, “Model Class Initialized”);
$this->load=$this->__get(“load”);
$this->db=$this->__get(“db”);
$this->calendar=$this->__get(“calendar”);
$this->email=$this->__get(“email”);
$this->encrypt=$this->__get(“encrypt”);
$this->ftp=$this->__get(“ftp”);
$this->hooks=$this->__get(“hooks”);
$this->image_lib=$this->__get(“image_lib”);
$this->language=$this->__get(“language”);
$this->log=$this->__get(“log”);
$this->output=$this->__get(“output”);
$this->pagination=$this->__get(“pagination”);
$this->parser=$this->__get(“parser”);
$this->session=$this->__get(“session”);
$this->sha1=$this->__get(“sha1″);
$this->table=$this->__get(“table”);
$this->trackback=$this->__get(“trackback”);
$this->unit=$this->__get(“unit”);
$this->upload=$this->__get(“upload”);
$this->uri=$this->__get(“uri”);
$this->agent=$this->__get(“agent”);
$this->validation=$this->__get(“validation”);
$this->xmlrpc=$this->__get(“xmlrpc”);
$this->zip=$this->__get(“zip”);
$this->usermodel=$this->__get(“usermodel”);
}

/**
* __get
*
* Allows models to access CI’s loaded classes using the same
* syntax as controllers.
*
* @param string
* @access private
*/
function __get($key)
{
$CI =& get_instance();
return $CI->$key;
}
}
// END Model Class

/* End of file Model.php */
/* Location: ./system/core/Model.php */

 

暂无评论

发表评论

快捷键:Ctrl+Enter