Skip to content

Snippets Atom for CodeIgniter

Steeve Droz edited this page Dec 4, 2017 · 2 revisions
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
#   'Console log':
#     'prefix': 'log'
#     'body': 'console.log $1'
#
# Each scope (e.g. '.source.coffee' above) can only be declared once.
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# http://flight-manual.atom.io/using-atom/sections/basic-customization/#_cson

'.php':
    'CodeIgniter template':
        'prefix': 'ci_template'
        'body': '''<?php
        defined('BASEPATH') OR exit('No direct script access allowed');

'''
    'CodeIgniter Controller':
        'prefix': 'ci_controller'
        'body': '''<?php
        defined('BASEPATH') OR exit('No direct script access allowed');

        class ${1:ClassName} extends CI_Controller
        {
            $0
        }
'''
    'CodeIgniter Model':
        'prefix': 'ci_model'
        'body': '''<?php
        defined('BASEPATH') OR exit('No direct script access allowed');

        class ${1:ClassName}_model extends CI_Model
        {
            $0
        }
'''
    'CodeIgniter View':
        'prefix': 'ci_view'
        'body': '''$this->load->view('templates/header');
        $this->load->view('pages/${1:controller}/${2:action}');
        $this->load->view('templates/footer');
        '''
    'CodeIgniter constructor':
        'prefix': 'construct'
        'body': '''public function __construct()
        {
            parent::__construct();
            $0
        }
'''
Clone this wiki locally