2014-11-04 06:59:18 -05:00
|
|
|
# Based on nebjak/snipmate.vim/snippets/php.snippets
|
|
|
|
|
|
|
|
# Controller
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_controller
|
2014-11-04 06:59:18 -05:00
|
|
|
class ${1:ClassName} extends CI_Controller {
|
|
|
|
function __construct() {
|
|
|
|
parent::__construct();
|
|
|
|
${2:// code...}
|
|
|
|
}
|
|
|
|
|
|
|
|
function ${3:index}() {
|
|
|
|
${4:// code...}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# Model
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_model
|
2014-11-04 06:59:18 -05:00
|
|
|
class ${1:ClassName_model} extends CI_Model {
|
|
|
|
function __construct() {
|
|
|
|
parent::__construct();
|
|
|
|
${2:// code...}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# Load view
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_load-view
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->load->view("${1:view_name}", $${2:data});${3}
|
|
|
|
# DB Class snippets
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_db-insert
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->db->insert("${1:table}", $${2:data});${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_db-select
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->db->select("${1:id, ...}");${2}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_db-from
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->db->from("${1:table}");${2}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_db-join
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->db->join("${1:table}", "${2:condition}", "${3:type}");${4}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_db-where
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->db->where("${1:key}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_db-or_where
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->db->or_where("${1:key}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_db-get
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->db->get("${1:table}", ${2:limit}, ${3:offset});${4}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_db-delete
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->db->delete("${1:table}", "${2:where}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_db-update
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->db->update("${1:table}", $${2:set}, $${3:where});${4}
|
|
|
|
# Input Class snippets
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_input-post
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->input->post("${1:index}");${2}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_input-get
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->input->get("${1:index}");${2}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_input-cookie
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->input->cookie("${1:index}");${2}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_input-server
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->input->server("${1:index}");${2}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_input-user_agent
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->input->user_agent();${1}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_input-is_ajax_request
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->input->is_ajax_request();${1}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_input-is_cli_request
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->input->is_cli_request();${1}
|
|
|
|
# Form Validation Class and Form Helper snippets
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_validation-set_rules
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->form_validation->set_rules("${1:field}", "${2:label}", "${3:trim|required}");${4}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_open
|
2014-11-04 06:59:18 -05:00
|
|
|
form_open("${1:action}");${2}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_open_multipart
|
2014-11-04 06:59:18 -05:00
|
|
|
form_open_multipart("${1:action}");${2}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_hidden
|
2014-11-04 06:59:18 -05:00
|
|
|
form_hidden("${1:name}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_input
|
2014-11-04 06:59:18 -05:00
|
|
|
form_input("${1:name}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_password
|
2014-11-04 06:59:18 -05:00
|
|
|
form_password("${1:name}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_upload
|
2014-11-04 06:59:18 -05:00
|
|
|
form_upload("${1:name}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_textarea
|
2014-11-04 06:59:18 -05:00
|
|
|
form_textarea("${1:name}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_dropdown
|
2014-11-04 06:59:18 -05:00
|
|
|
form_dropdown("${1:name}", $${2:options}, $${3:selected);${4}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_checkbox
|
2014-11-04 06:59:18 -05:00
|
|
|
form_checkbox("${1:name}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_radio
|
2014-11-04 06:59:18 -05:00
|
|
|
form_radio("${1:name}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_submit
|
2014-11-04 06:59:18 -05:00
|
|
|
form_submit("${1:name}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_reset
|
2014-11-04 06:59:18 -05:00
|
|
|
form_reset("${1:name}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_button
|
2014-11-04 06:59:18 -05:00
|
|
|
form_button("${1:name}", "${2:value}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_label
|
2014-11-04 06:59:18 -05:00
|
|
|
form_label("${1:label text}", "${2:id}");${3}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_form_close
|
2014-11-04 06:59:18 -05:00
|
|
|
form_close();${1}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_validation_errors
|
2014-11-04 06:59:18 -05:00
|
|
|
validation_errors();${1}
|
|
|
|
# Session Class snippets
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_session_userdata
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->session->userdata("${1:item}");${2}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_session_set_userdata
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->session->set_userdata($${1:array});${2}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_session_flashdata
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->session->flashdata("${1:item}");${2}
|
2014-11-04 18:03:21 -05:00
|
|
|
snippet ci_session_set_flashdata
|
2014-11-04 06:59:18 -05:00
|
|
|
$this->session->set_flashdata("${1:item}", "${2:value}");${3}
|