Codeigniter 3.0 相关文档 part one
2016-09-01 00:50
591 查看
分页配置项
http://stackoverflow.com/questions/18418900/codeigniter-pagination-config-without-repeating-within-different-controllers相关工具
google搜索"codeigniter generator",会有几个自动化的工具http://crudigniter.com/
https://bitbucket.org/harviacode/codeigniter-crud-generator
http://formigniter.org/
增加全局变量
config/constants.php增加站点配置项
在config目录下新建site_settings.php,在里面添加配置项:<?php defined('BASEPATH') OR exit('No direct script access allowed'); $config['site_name'] = 'site name goes heere'; $config['site_description'] = 'site description'; $config['author'] = 'matt'; $config['author_site'] = 'matt';
在controller里加载配置并调用配置项
$this->config->load('site_settings',TRUE); $site_name = $this->config->item('site_name');
如果你在使用 $this->config->load 方法时使用了第二个参数,每个配置文件中的配置 被存储到以该配置文件名为索引的数组中,要获取该配置项,你可以将 $this->config->item() 方法的第二个参数设置为这个索引名(也就是配置文件名)。
Config Class
增加全局函数
如果是系统层面已有,做补充的,可以在system/helpers/xxx_helper.php添加如果是完全自定义的,可以application/helpers/添加
记得在autoload.php里引入
$autoload['helpers'] = array('your-global-function-file.php');
全字段查询工具
https://datatables.net/examples/api/为当前链接添加active样式
增加一个menu_helper的工具<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); if(!function_exists('active_link')) { function activate_menu($controller) { // Getting CI class instance. $CI = get_instance(); // Getting router class to active. $class = $CI->router->fetch_class(); return ($class == $controller) ? 'active' : ''; } }
在链接中使用
<li class="<?php echo activate_menu('login'); ?>"> <?php echo anchor('login', 'Login'); ?> </li>
参考资料
http://stackoverflow.com/questions/10831213/where-to-place-global-functions-in-codeigniterhttp://codeigniter.org.cn/user_guide/general/index.html
相关文章推荐
- 双系统ubuntu14.04无法引导win10问题
- 距离向量路由算法的Java模拟
- 乐视手机H5项目总结
- mysql 给表添加一个联合唯一索引
- TCP/IP的三次握手与四次挥手详解
- hdu1166 敌兵布阵
- itpt_TCPL 第三章:控制流
- 51Nod-1281-山峰和旗子
- Redis和Memcache对比及选择
- JavaBean、EL表达式${ }、作用域-自动转换、常用方法
- 数据结构之深度搜索
- (九)修改和删除部门功能模块的实现
- RxJava系列5(组合操作符)
- ZooKeeper OverView
- RxJava系列4(过滤操作符)
- idea key
- 夺命雷公狗---node.js---18之项目的构建在node+express+mongo的博客项目3头尾左侧分离法
- RxJava系列3(转换操作符)
- RxJava系列2(基本概念及使用介绍)
- 51nod - 1035 最长的循环节 - 数论