Note that there are some explanatory texts on larger screens.

plurals
  1. POEclipse PDT and autocomplete for CI 2.0
    primarykey
    data
    text
    <p>I was following this tutorial for autocomplete and it works fine except autocomplete for MY_X not working.</p> <p><a href="http://taggedzi.com/articles/display/autocomplete-eclipse-codeigniter-2" rel="nofollow">http://taggedzi.com/articles/display/autocomplete-eclipse-codeigniter-2</a></p> <p>How to enable autocomplete in MY_X classes?</p> <p>Code for MY_model for example:</p> <pre><code>class MY_Model extends CI_Model { public $auto_validate = TRUE; // use auto-validation before saving public $return_method = 'auto'; // object, array, query, auto public $auto_validate_fields = array( 'email|email_address' =&gt; 'valid_email', 'phone|phone_number' =&gt; 'valid_phone' ); // fields to auto validate public $required = array(); // required fields public $default_required_message; //public $default_required_message = "Please fill out the required field '%1s'"; // the default required validator message public $auto_date_add = array('date_added', 'entry_date'); // field names to automatically set the date when the value is NULL public $auto_date_update = array('last_modified', 'last_updated'); // field names to automatically set the date on updates public $date_use_gmt = FALSE; // datetime method public $default_date = 0; // default date value that get's passed to the model on save. Using 0000-00-00 will not work if it is a required field since it is not seen as an empty value public $auto_trim = TRUE; // will trim on clean public $auto_encode_entities = TRUE; // automatically encode html entities public $xss_clean = FALSE; // automatically run the xss_clean public $readonly = FALSE; // sets the model to readonly mode where you can't save or delete data' public $hidden_fields = array(); // fields to hide when creating a form public $unique_fields = array(); // fields that are not IDs but are unique public $linked_fields = array(); // fields that are are linked. Key is the field, value is a function name to transform it public $foreign_keys = array(); // map foreign keys to table models protected $db; // CI database object protected $table_name; // the table name to associate the model with protected $key_field = 'id'; // usually the tables primary key(s)... can be an array if compound key protected $normalized_save_data = NULL; // the saved data before it is cleaned protected $cleaned_data = NULL; // data after it is cleaned protected $dsn = ''; // the DSN string to connect to the database... if blank it will pull in from database config file protected $has_auto_increment = TRUE; // does the table have auto_increment? protected $suffix = '_model'; // the suffix used for the data record class protected $record_class = ''; // the name of the record class (if it can't be determined) protected $rules = array(); // validation rules protected $fields = array(); // fields in the table protected $use_common_query = TRUE; // include the _common_query method for each query protected $validator = NULL; // the validator object /** * Constructor - Sets MY_Model preferences * * The constructor can be passed an array of config values */ public function __construct($table = NULL, $params = array()) { parent::__construct(); $this-&gt;default_required_message = lang('error_required_message').' \'%1s\''; // the default required validator message // load helpers here $this-&gt;load-&gt;helper('string'); $this-&gt;load-&gt;helper('date'); $this-&gt;load-&gt;helper('security'); $this-&gt;load-&gt;helper('language'); $this-&gt;initialize($table, $params); } // -------------------------------------------------------------------- /** * Initialize the user preferences * * Accepts an associative array as input, containing display preferences * * @access public * @param string the table name * @param array config preferences * @return void */ public function initialize($table = NULL, $params = array()) { if (!empty($table)) { $this-&gt;table_name = $table; } else { $this-&gt;table_name = strtolower(get_class($this)); } if (!empty($params)) { foreach ($params as $key =&gt; $val) { if (isset($this-&gt;$key)) { $this-&gt;$key = $val; } } } // if a DSN property is set,then we will load that database in if (!empty($this-&gt;dsn)) { $this-&gt;db = $this-&gt;load-&gt;database($this-&gt;dsn, TRUE, TRUE); } else { // else we use the database set on the CI object if (empty($this-&gt;db)) { $this-&gt;load-&gt;database($this-&gt;dsn); } $CI =&amp; get_instance(); if (isset($CI-&gt;db)) { // create a copy of the DB object to prevent cross model interference unset($this-&gt;db); $this-&gt;db = clone $CI-&gt;db; } else { $CI-&gt;load-&gt;language('db'); show_error(lang('db_unable_to_connect')); } } $this-&gt;validator = new Validator(); $this-&gt;validator-&gt;register_to_global_errors = FALSE; } // -------------------------------------------------------------------- /** * Returns the database object * * @access public * @return array */ public function &amp;db;() { // $this-&gt;_check_readonly(); return $this-&gt;db; } // -------------------------------------------------------------------- /** * Gets the short name minus the suffix * * @access public * @return array */ public function short_name($lower = FALSE, $record_class = FALSE) { $class_name = ($record_class) ? $this-&gt;record_class_name() : get_class($this); $end_index = strlen($class_name) - strlen($this-&gt;suffix); $short_name = substr($class_name, 0, $end_index); if ($lower) { return strtolower($short_name); } else { return $short_name; } } // -------------------------------------------------------------------- /** * Get the table name * * @access public * @return array */ public function table_name() { return $this-&gt;table_name; } ..... </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload