spacevim/bundle/vim-snippets/snippets/codeigniter.snippets
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

172 lines
4.5 KiB
Plaintext

# Based on nebjak/snipmate.vim/snippets/php.snippets
# Controller
snippet ci_controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName} extends CI_Controller
{
function __construct()
{
parent::__construct();
${2:// code...}
}
function ${3:index}()
{
${4:// code...}
}
}
# Model
snippet ci_model
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName_model} extends CI_Model
{
function __construct()
{
parent::__construct();
${2:// code...}
}
}
snippet ci_model_crudl
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ${1:ClassName_model} extends CI_Model
{
private $table = '${2:table_name}';
function __construct()
{
parent::__construct();
${3:// code...}
}
public function create($data)
{
if($this->db->insert($this->table, $data))
return true;
else
return false;
}
public function read($id)
{
return $this->db->get_where($this->table, array('id', $id))->result();
}
public function update($id, $data)
{
if($this->db->update($this->table, $data, array('id' => $id)))
return true;
else
return false;
}
public function delete($id)
{
if(is_array($id))
{
$this->db->trans_start();
foreach($id as $elem)
$this->db->delete($this->table, array('id' => $elem));
$this->db->trans_complete();
}
else
{
if($this->db->delete($this->table, array('id' => $id)))
return true;
else
return false;
}
}
public function listRows($limit = null, $offset = 0)
{
if(!is_null($limit))
$this->db->limit($limit, $offset);
return $this->db->get($this->table)->result();
}
}
# Load view
snippet ci_load-view
$this->load->view("${1:view_name}", $${2:data});${3}
# DB Class snippets
snippet ci_db-insert
$this->db->insert("${1:table}", $${2:data});${3}
snippet ci_db-select
$this->db->select("${1:id, ...}");${2}
snippet ci_db-from
$this->db->from("${1:table}");${2}
snippet ci_db-join
$this->db->join("${1:table}", "${2:condition}", "${3:type}");${4}
snippet ci_db-where
$this->db->where("${1:key}", "${2:value}");${3}
snippet ci_db-or_where
$this->db->or_where("${1:key}", "${2:value}");${3}
snippet ci_db-get
$this->db->get("${1:table}", ${2:limit}, ${3:offset});${4}
snippet ci_db-delete
$this->db->delete("${1:table}", "${2:where}");${3}
snippet ci_db-update
$this->db->update("${1:table}", $${2:set}, $${3:where});${4}
# Input Class snippets
snippet ci_input-post
$this->input->post("${1:index}");${2}
snippet ci_input-get
$this->input->get("${1:index}");${2}
snippet ci_input-cookie
$this->input->cookie("${1:index}");${2}
snippet ci_input-server
$this->input->server("${1:index}");${2}
snippet ci_input-user_agent
$this->input->user_agent();${1}
snippet ci_input-is_ajax_request
$this->input->is_ajax_request();${1}
snippet ci_input-is_cli_request
$this->input->is_cli_request();${1}
# Form Validation Class and Form Helper snippets
snippet ci_form_validation-set_rules
$this->form_validation->set_rules("${1:field}", "${2:label}", "${3:trim|required}");${4}
snippet ci_form_open
form_open("${1:action}");${2}
snippet ci_form_open_multipart
form_open_multipart("${1:action}");${2}
snippet ci_form_hidden
form_hidden("${1:name}", "${2:value}");${3}
snippet ci_form_input
form_input("${1:name}", "${2:value}");${3}
snippet ci_form_password
form_password("${1:name}", "${2:value}");${3}
snippet ci_form_upload
form_upload("${1:name}", "${2:value}");${3}
snippet ci_form_textarea
form_textarea("${1:name}", "${2:value}");${3}
snippet ci_form_dropdown
form_dropdown("${1:name}", $${2:options}, $${3:selected);${4}
snippet ci_form_checkbox
form_checkbox("${1:name}", "${2:value}");${3}
snippet ci_form_radio
form_radio("${1:name}", "${2:value}");${3}
snippet ci_form_submit
form_submit("${1:name}", "${2:value}");${3}
snippet ci_form_reset
form_reset("${1:name}", "${2:value}");${3}
snippet ci_form_button
form_button("${1:name}", "${2:value}");${3}
snippet ci_form_label
form_label("${1:label text}", "${2:id}");${3}
snippet ci_form_close
form_close();${1}
snippet ci_validation_errors
validation_errors();${1}
# Session Class snippets
snippet ci_session_userdata
$this->session->userdata("${1:item}");${2}
snippet ci_session_set_userdata
$this->session->set_userdata($${1:array});${2}
snippet ci_session_flashdata
$this->session->flashdata("${1:item}");${2}
snippet ci_session_set_flashdata
$this->session->set_flashdata("${1:item}", "${2:value}");${3}