From 20c097830a1a5a313f764509a30890aaaf3d0343 Mon Sep 17 00:00:00 2001 From: rtorralba Date: Tue, 4 Nov 2014 12:59:18 +0100 Subject: [PATCH 1/3] added codeigniter snippets --- snippets/ci.snippets | 103 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 snippets/ci.snippets diff --git a/snippets/ci.snippets b/snippets/ci.snippets new file mode 100644 index 0000000..cb0e862 --- /dev/null +++ b/snippets/ci.snippets @@ -0,0 +1,103 @@ +# Based on nebjak/snipmate.vim/snippets/php.snippets + +# Controller +snippet cic + class ${1:ClassName} extends CI_Controller { + function __construct() { + parent::__construct(); + ${2:// code...} + } + + function ${3:index}() { + ${4:// code...} + } + } +# Model +snippet cim + class ${1:ClassName_model} extends CI_Model { + function __construct() { + parent::__construct(); + ${2:// code...} + } + } +# Load view +snippet cilv + $this->load->view("${1:view_name}", $${2:data});${3} +# DB Class snippets +snippet cidbi + $this->db->insert("${1:table}", $${2:data});${3} +snippet cidbs + $this->db->select("${1:id, ...}");${2} +snippet cidbf + $this->db->from("${1:table}");${2} +snippet cidbj + $this->db->join("${1:table}", "${2:condition}", "${3:type}");${4} +snippet cidbw + $this->db->where("${1:key}", "${2:value}");${3} +snippet cidbow + $this->db->or_where("${1:key}", "${2:value}");${3} +snippet cidbg + $this->db->get("${1:table}", ${2:limit}, ${3:offset});${4} +snippet cidbd + $this->db->delete("${1:table}", "${2:where}");${3} +snippet cidbu + $this->db->update("${1:table}", $${2:set}, $${3:where});${4} +# Input Class snippets +snippet ciip + $this->input->post("${1:index}");${2} +snippet ciig + $this->input->get("${1:index}");${2} +snippet ciic + $this->input->cookie("${1:index}");${2} +snippet ciis + $this->input->server("${1:index}");${2} +snippet ciiua + $this->input->user_agent();${1} +snippet ciiajax + $this->input->is_ajax_request();${1} +snippet ciicli + $this->input->is_cli_request();${1} +# Form Validation Class and Form Helper snippets +snippet cifvsr + $this->form_validation->set_rules("${1:field}", "${2:label}", "${3:trim|required}");${4} +snippet cifo + form_open("${1:action}");${2} +snippet cifom + form_open_multipart("${1:action}");${2} +snippet cifh + form_hidden("${1:name}", "${2:value}");${3} +snippet cifi + form_input("${1:name}", "${2:value}");${3} +snippet cifp + form_password("${1:name}", "${2:value}");${3} +snippet cifu + form_upload("${1:name}", "${2:value}");${3} +snippet cifta + form_textarea("${1:name}", "${2:value}");${3} +snippet cifdd + form_dropdown("${1:name}", $${2:options}, $${3:selected);${4} +snippet cifcb + form_checkbox("${1:name}", "${2:value}");${3} +snippet cifr + form_radio("${1:name}", "${2:value}");${3} +snippet cifsub + form_submit("${1:name}", "${2:value}");${3} +snippet cifres + form_reset("${1:name}", "${2:value}");${3} +snippet cifbut + form_button("${1:name}", "${2:value}");${3} +snippet ciflab + form_label("${1:label text}", "${2:id}");${3} +snippet cifc + form_close();${1} +snippet civerr + validation_errors();${1} +# Session Class snippets +snippet cisud + $this->session->userdata("${1:item}");${2} +snippet cissud + $this->session->set_userdata($${1:array});${2} +snippet cisfd + $this->session->flashdata("${1:item}");${2} +snippet cissfd + $this->session->set_flashdata("${1:item}", "${2:value}");${3} From dc2db83d140fe6e51b47e65c33e3f0cad92d0f27 Mon Sep 17 00:00:00 2001 From: rtorralba Date: Tue, 4 Nov 2014 13:22:29 +0100 Subject: [PATCH 2/3] rename ci.snippets to codeigniter.snippets --- snippets/{ci.snippets => codeigniter.snippets} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename snippets/{ci.snippets => codeigniter.snippets} (100%) diff --git a/snippets/ci.snippets b/snippets/codeigniter.snippets similarity index 100% rename from snippets/ci.snippets rename to snippets/codeigniter.snippets From ba77d58d08bb706df7c5240edde073883f9f12df Mon Sep 17 00:00:00 2001 From: rtorralba Date: Wed, 5 Nov 2014 00:03:21 +0100 Subject: [PATCH 3/3] rename snippets key for to give more information about snippet --- snippets/codeigniter.snippets | 80 +++++++++++++++++------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/snippets/codeigniter.snippets b/snippets/codeigniter.snippets index cb0e862..5dcd2da 100644 --- a/snippets/codeigniter.snippets +++ b/snippets/codeigniter.snippets @@ -1,7 +1,7 @@ # Based on nebjak/snipmate.vim/snippets/php.snippets # Controller -snippet cic +snippet ci_controller class ${1:ClassName} extends CI_Controller { function __construct() { parent::__construct(); @@ -13,7 +13,7 @@ snippet cic } } # Model -snippet cim +snippet ci_model class ${1:ClassName_model} extends CI_Model { function __construct() { parent::__construct(); @@ -21,83 +21,83 @@ snippet cim } } # Load view -snippet cilv +snippet ci_load-view $this->load->view("${1:view_name}", $${2:data});${3} # DB Class snippets -snippet cidbi +snippet ci_db-insert $this->db->insert("${1:table}", $${2:data});${3} -snippet cidbs +snippet ci_db-select $this->db->select("${1:id, ...}");${2} -snippet cidbf +snippet ci_db-from $this->db->from("${1:table}");${2} -snippet cidbj +snippet ci_db-join $this->db->join("${1:table}", "${2:condition}", "${3:type}");${4} -snippet cidbw +snippet ci_db-where $this->db->where("${1:key}", "${2:value}");${3} -snippet cidbow +snippet ci_db-or_where $this->db->or_where("${1:key}", "${2:value}");${3} -snippet cidbg +snippet ci_db-get $this->db->get("${1:table}", ${2:limit}, ${3:offset});${4} -snippet cidbd +snippet ci_db-delete $this->db->delete("${1:table}", "${2:where}");${3} -snippet cidbu +snippet ci_db-update $this->db->update("${1:table}", $${2:set}, $${3:where});${4} # Input Class snippets -snippet ciip +snippet ci_input-post $this->input->post("${1:index}");${2} -snippet ciig +snippet ci_input-get $this->input->get("${1:index}");${2} -snippet ciic +snippet ci_input-cookie $this->input->cookie("${1:index}");${2} -snippet ciis +snippet ci_input-server $this->input->server("${1:index}");${2} -snippet ciiua +snippet ci_input-user_agent $this->input->user_agent();${1} -snippet ciiajax +snippet ci_input-is_ajax_request $this->input->is_ajax_request();${1} -snippet ciicli +snippet ci_input-is_cli_request $this->input->is_cli_request();${1} # Form Validation Class and Form Helper snippets -snippet cifvsr +snippet ci_form_validation-set_rules $this->form_validation->set_rules("${1:field}", "${2:label}", "${3:trim|required}");${4} -snippet cifo +snippet ci_form_open form_open("${1:action}");${2} -snippet cifom +snippet ci_form_open_multipart form_open_multipart("${1:action}");${2} -snippet cifh +snippet ci_form_hidden form_hidden("${1:name}", "${2:value}");${3} -snippet cifi +snippet ci_form_input form_input("${1:name}", "${2:value}");${3} -snippet cifp +snippet ci_form_password form_password("${1:name}", "${2:value}");${3} -snippet cifu +snippet ci_form_upload form_upload("${1:name}", "${2:value}");${3} -snippet cifta +snippet ci_form_textarea form_textarea("${1:name}", "${2:value}");${3} -snippet cifdd +snippet ci_form_dropdown form_dropdown("${1:name}", $${2:options}, $${3:selected);${4} -snippet cifcb +snippet ci_form_checkbox form_checkbox("${1:name}", "${2:value}");${3} -snippet cifr +snippet ci_form_radio form_radio("${1:name}", "${2:value}");${3} -snippet cifsub +snippet ci_form_submit form_submit("${1:name}", "${2:value}");${3} -snippet cifres +snippet ci_form_reset form_reset("${1:name}", "${2:value}");${3} -snippet cifbut +snippet ci_form_button form_button("${1:name}", "${2:value}");${3} -snippet ciflab +snippet ci_form_label form_label("${1:label text}", "${2:id}");${3} -snippet cifc +snippet ci_form_close form_close();${1} -snippet civerr +snippet ci_validation_errors validation_errors();${1} # Session Class snippets -snippet cisud +snippet ci_session_userdata $this->session->userdata("${1:item}");${2} -snippet cissud +snippet ci_session_set_userdata $this->session->set_userdata($${1:array});${2} -snippet cisfd +snippet ci_session_flashdata $this->session->flashdata("${1:item}");${2} -snippet cissfd +snippet ci_session_set_flashdata $this->session->set_flashdata("${1:item}", "${2:value}");${3}