Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Code snippets for developing with ThinkPHP framework

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 README.md
Octocat-spinner-32 tp- $.sublime-snippet
Octocat-spinner-32 tp- Action.sublime-snippet
Octocat-spinner-32 tp- Model.sublime-snippet
Octocat-spinner-32 tp- _after_delete.sublime-snippet
Octocat-spinner-32 tp- _after_find.sublime-snippet
Octocat-spinner-32 tp- _after_insert.sublime-snippet
Octocat-spinner-32 tp- _after_update.sublime-snippet
Octocat-spinner-32 tp- _before_insert.sublime-snippet
Octocat-spinner-32 tp- _before_update.sublime-snippet fix paramter $ July 31, 2012
Octocat-spinner-32 tp- _empty.sublime-snippet
Octocat-spinner-32 tp- _get.sublime-snippet
Octocat-spinner-32 tp- _sql.sublime-snippet
Octocat-spinner-32 tp- addAll.sublime-snippet
Octocat-spinner-32 tp- ajaxReturn.sublime-snippet 添加文件 July 21, 2012
Octocat-spinner-32 tp- alias.sublime-snippet
Octocat-spinner-32 tp- assign.sublime-snippet
Octocat-spinner-32 tp- auto.sublime-snippet
Octocat-spinner-32 tp- avg.sublime-snippet
Octocat-spinner-32 tp- buildSql.sublime-snippet
Octocat-spinner-32 tp- commit.sublime-snippet
Octocat-spinner-32 tp- count.sublime-snippet
Octocat-spinner-32 tp- create.sublime-snippet
Octocat-spinner-32 tp- delete.sublime-snippet
Octocat-spinner-32 tp- display.sublime-snippet
Octocat-spinner-32 tp- distinct.sublime-snippet
Octocat-spinner-32 tp- error.sublime-snippet
Octocat-spinner-32 tp- execute.sublime-snippet
Octocat-spinner-32 tp- fetch.sublime-snippet
Octocat-spinner-32 tp- field.sublime-snippet
Octocat-spinner-32 tp- find.sublime-snippet
Octocat-spinner-32 tp- getActionName.sublime-snippet
Octocat-spinner-32 tp- getError .sublime-snippet
Octocat-spinner-32 tp- getError.sublime-snippet
Octocat-spinner-32 tp- getField.sublime-snippet
Octocat-spinner-32 tp- getModelName.sublime-snippet
Octocat-spinner-32 tp- getTableName.sublime-snippet
Octocat-spinner-32 tp- group.sublime-snippet
Octocat-spinner-32 tp- having.sublime-snippet
Octocat-spinner-32 tp- isAjax.sublime-snippet
Octocat-spinner-32 tp- isdelete.sublime-snippet 添加文件 July 21, 2012
Octocat-spinner-32 tp- isget.sublime-snippet
Octocat-spinner-32 tp- ishead.sublime-snippet
Octocat-spinner-32 tp- ispost.sublime-snippet 添加文件 July 21, 2012
Octocat-spinner-32 tp- isput.sublime-snippet
Octocat-spinner-32 tp- layout.sublime-snippet
Octocat-spinner-32 tp- limit.sublime-snippet
Octocat-spinner-32 tp- literal.sublime-snippet
Octocat-spinner-32 tp- lock.sublime-snippet
Octocat-spinner-32 tp- max.sublime-snippet
Octocat-spinner-32 tp- min.sublime-snippet
Octocat-spinner-32 tp- order.sublime-snippet
Octocat-spinner-32 tp- page.sublime-snippet
Octocat-spinner-32 tp- php.sublime-snippet
Octocat-spinner-32 tp- post.sublime-snippet
Octocat-spinner-32 tp- query.sublime-snippet
Octocat-spinner-32 tp- redirect.sublime-snippet
Octocat-spinner-32 tp- rollback.sublime-snippet
Octocat-spinner-32 tp- selectAdd.sublime-snippet
Octocat-spinner-32 tp- setField.sublime-snippet
Octocat-spinner-32 tp- setInc.sublime-snippet
Octocat-spinner-32 tp- setProperty.sublime-snippet
Octocat-spinner-32 tp- startTrans.sublime-snippet
Octocat-spinner-32 tp- success.sublime-snippet
Octocat-spinner-32 tp- sum.sublime-snippet
Octocat-spinner-32 tp- switchModel.sublime-snippet 添加文件 July 21, 2012
Octocat-spinner-32 tp- tablePrefix.sublime-snippet
Octocat-spinner-32 tp- trueTableName.sublime-snippet
Octocat-spinner-32 tp- validate.sublime-snippet
Octocat-spinner-32 tp- where.sublime-snippet
Octocat-spinner-32 tp-$ fun.sublime-snippet
Octocat-spinner-32 tp-$.sublime-snippet
Octocat-spinner-32 tp-defalut.sublime-snippet
Octocat-spinner-32 tp-empty.sublime-snippet
Octocat-spinner-32 tp-eq.sublime-snippet
Octocat-spinner-32 tp-include.sublime-snippet
Octocat-spinner-32 tp-nolayout.sublime-snippet
Octocat-spinner-32 tp-present $.sublime-snippet
Octocat-spinner-32 tp-switch.sublime-snippet
Octocat-spinner-32 tp-table.sublime-snippet
Octocat-spinner-32 tp-volist.sublime-snippet
README.md

ThinkPHP-Snippets

Code snippets for developing with ThinkPHP framework

The plugin give you 3 places to generate code(template eg: *.html ,action & model eg: *.php.)

Here are all the snippets stand for: str,tab -> [source code] .html: :,tab ->{:fun()} layout,tab -> {CONTENT} php,tab -> echo 'Hello,world!'; |fun,tab -> {$name|fun=arg1,###} |def,tab -> {$name|default="**"} $.tab -> {$name} emp,tab -> name为空 name不为空 eq,tab -> value inc,tab -> nolayout,tab -> {NOLAYOUT} pre,tab -> name已经赋值name还没有赋值 switch,tab -> value1value2default vo,tab -> {$key}.{$vo.name} *.php: Action,tab -> Class IndexAction extends Action{ public function index}(){

                        }
                     }
    auto,tab -> protected $_auto = array ( 
array('status','1'),  // 新增的时候把status字段设置为1
array('password','md5',1,'function') , // 对password字段在新增的时候使md5函数处理
array('name','getName',1,'callback'), // 对name字段在新增的时候回调getName方法
array('create_time','time',2,'function'), // 对create_time字段在更新的时候写入当前时间戳

); Model,tab -> Class $NewModel extends Model{

} table,tab -> protected $tablePrefix true,tab -> protected $trueTableName val,tab -> protected $_validate = array( array('verify','require','验证码必须!'), //默认情况下用正则进行验证 array('name','','帐号名称已经存在!',0,'unique',1), // 在新增的时候验证name字段是否唯一 array('value',array(1,2,3),'值的范围不正确!',2,'in'), // 当值不为空的时候判断是否在一个范围内 array('repassword','password','确认密码不正确',0,'confirm'), // 验证确认密码是否和密码一致 array('password','checkPwd','密码格式不正确',0,'function'), // 自定义函数验证密码格式 ); _a,tab ->protected function _after_delete($data,$options) {

               }
    _a,tab -> protected function _after_find(&$result,$options) {

               }
    _a,tab -> protected function _after_insert($data,$options) {

                }
        _a,tab -> protected function _after_update($data,$options) {

                }
        _b,tab -> protected function _before_insert(&$data,$options) {

                }

    _b,tab -> protected function _before_update(&$data,$options) {

                }
        $this-> -> $this->ajaxReturn($data,$info,$status,$type);
        $this-> ->$this->assign('name',$name);
        $this-> -> $this->display();
        $this-> -> $this->error();
        $this-> -> $this->fetch();
        $this-> -> $this->getActionName();
        $this-> -> $this->isAjax();
        $this-> -> $this->isDelete();
        $this-> -> $this->isGet();
        $this-> -> $this->isHead();
        $this-> -> $this->isPost();
        $this-> -> $this->isPut();
        $this-> -> $this->redirect($url,$params,$delay,$msg);
        $this-> -> $this->success();
        $this-> -> $this->_empty();
        this-> -> $this->_post();
        $this-> -> $this->_get($name);
    ->,tab -> ->_sql();
    ->,tab -> ->addAll($dataList,$options,$replace);
    ->,tab -> ->alias();
    ->,tab -> ->avg();
    ->,tab -> ->buildSql();
    ->,tab -> ->commit();
    ->,tab -> ->count();
    ->,tab -> ->create();
    ->,tab -> ->delete();
    ->,tab -> ->distinct();
    ->,tab -> ->execute();
    ->,tab -> ->field();
    ->,tab -> ->find();
    ->,tab -> ->getDbError();
    ->,tab -> ->getError();
    ->,tab -> ->getField($field,$value);
    ->,tab -> ->getModelName();
    ->,tab -> ->group();
    ->,tab -> ->having();
    ->,tab -> ->limit();
    ->,tab -> ->lock();
    ->,tab -> ->max();
    ->,tab -> ->min();
    ->,tab -> ->order();
    ->,tab -> ->page();
    ->,tab -> ->query();
    ->,tab -> ->rollback();
    ->,tab -> ->selectAdd();
    ->,tab -> ->setField();
    ->,tab -> ->setInc();
    ->,tab -> ->setProperty();
    ->,tab -> ->startTrans();
    ->,tab -> ->sum();
    ->,tab -> ->switchModel();
    ->,tab -> ->where();
    ->,tab -> ->table();
Something went wrong with that request. Please try again.