From 56b3280f500be3180a99b9da3b70e46aa84e29b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Jakovljevi=C4=87?= Date: Sun, 4 Dec 2011 20:11:59 +0100 Subject: [PATCH 1/6] Added CI controller and model --- snippets/php.snippets | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index 3ce9e26c..246500f1 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -214,3 +214,31 @@ snippet fun # $... = array (...) snippet array $${1:arrayName} = array('${2}' => ${3});${4} +################################################### +### Codeigniter snipets ### +################################################### +# 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...} + } + } From a96b00c2c9fa455bd3a46fa97184f678b72728df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Jakovljevi=C4=87?= Date: Mon, 5 Dec 2011 09:32:28 +0100 Subject: [PATCH 2/6] DB Class snippets --- snippets/php.snippets | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index 246500f1..21596097 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -219,26 +219,43 @@ snippet array ################################################### # Controller snippet cic - class ${1:ClassName} extends CI_Controller - { - function __construct() - { + class ${1:ClassName} extends CI_Controller { + function __construct() { parent::__construct(); ${2:// code...} } - function ${3:index}() - { + function ${3:index}() { ${4:// code...} } } # Model snippet cim - class ${1:ClassName_model} extends CI_Model - { - function __construct() - { + 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} From f700bb99c9eb754cd794fbd313569a9039d59cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Jakovljevi=C4=87?= Date: Mon, 5 Dec 2011 09:46:03 +0100 Subject: [PATCH 3/6] Input Class snippets --- snippets/php.snippets | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index 21596097..b57f74a9 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -259,3 +259,18 @@ 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} From 002c536949eac207f9a9d04984e5d0b22b84e676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Jakovljevi=C4=87?= Date: Mon, 5 Dec 2011 11:41:55 +0100 Subject: [PATCH 4/6] Form Validation Class and Form Helper snippets --- snippets/php.snippets | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index b57f74a9..580c98c0 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -274,3 +274,38 @@ 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} From 8e583e4a3c1c9ffa25f48f9db80917c4c11b21a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Jakovljevi=C4=87?= Date: Mon, 5 Dec 2011 12:05:44 +0100 Subject: [PATCH 5/6] Session Class snippets --- snippets/php.snippets | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index 580c98c0..2273598b 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -309,3 +309,12 @@ 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 3bca1e78ad50288028bd98086dffed573abb8418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Jakovljevi=C4=87?= Date: Thu, 13 Dec 2012 16:33:22 +0100 Subject: [PATCH 6/6] added snippets for quick embeding php in html --- snippets/php.snippets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/snippets/php.snippets b/snippets/php.snippets index 2273598b..215fc324 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -2,6 +2,10 @@ snippet php +snippet = + +snippet ? + snippet ec echo "${1:string}"${2}; snippet inc