Codeigniter 3.0 相关文档 part one
分页配置项
相关工具
google搜索"codeigniter generator",会有几个自动化的工具
http://crudigniter.com/
https://bitbucket.org/harviacode/codeigniter-crud-generator
增加全局变量
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-codeigniter
http://codeigniter.org.cn/user_guide/general/index.html
Codeigniter 3.0 相关文档 part one的更多相关文章
- Codeigniter 3.0 相关文档 part two
分页 首先,配置 $this->load->library('pagination'); $config = array(); // $this->config->load(' ...
- dotNET跨平台相关文档整理
一直在从事C#开发的相关技术工作,从C# 1.0一路用到现在的C# 6.0, 通常情况下被局限于Windows平台,Mono项目把我们C#程序带到了Windows之外的平台,在工作之余花了很多时间在M ...
- Mybatis-Generator 自动生成Dao、Model、Mapping相关文档
最近在学习mybatis,结果在写Mapping的映射文件时insert语句一直报错,于是想看看标准的映射文件是什么样.百度到Mybatis-Generator 自动生成Dao.Model.Mappi ...
- 李洪强iOS开发之-环信02.1_环信 SDK 2.x到3.0升级文档
李洪强iOS开发之-环信02.1_环信 SDK 2.x到3.0升级文档 SDK 2.x 至 3.0 升级指南 环信 SDK 3.0 升级文档 3.0 中的核心类为 EMClient 类,通过 EMCl ...
- dotNET跨平台相关文档
dotNET跨平台相关文档整理 一直在从事C#开发的相关技术工作,从C# 1.0一路用到现在的C# 6.0, 通常情况下被局限于Windows平台,Mono项目把我们C#程序带到了Windows之外的 ...
- Apache DolphinScheduler 1.2.0 使用文档(1/8):架构及名词解释
本文章经授权转载,原文链接: https://blog.csdn.net/MiaoSO/article/details/104770720 目录 1. 架构及名词解释 1.1 DolphinSched ...
- Android SDK API (2.2,2.3,3.0)中文版文档
转的一篇.觉得很有用. Android SDK API (2.2,2.3,3.0)中文版文档 地址:http://android.laoguo.org固定连接:http://www.laoguo.or ...
- Fortify 4.0 帮助文档下载
Fortify 4.0 帮助文档下载 http://pan.baidu.com/s/1hqzbF8o
- VLC的相关文档以及javascript接口
参看下面链接:VLC相关文档
随机推荐
- 疯狂java笔记(五) - 系统交互、System、Runtime、Date类
一.程序与用户交互(Java的入口方法-main方法): 运行Java程序时,都必须提供一个main方法入口:public static void main(String[] args){} publ ...
- BZOJ1082: [SCOI2005]栅栏 题解
题目大意: 有一些木材,可以没有浪费地将一根木材分成几块木板(比如长度为10的木板可以切成长度为8和2的两块木板).现在你希望得到一些长度的木板,问通过分割木材最多能得到几块想要的木板. 思路: 首先 ...
- git 设置多项目实现多账号登陆
9:45 2015/11/18git 设置多项目时实现多账号用户登陆git config --global user.name "your_name" git config --g ...
- Crystal Reports 2008(水晶报表) JDBC连接mysql数据库
在本blog中,主要介绍的是Crystal Reports 2008使用JDBC连接mysql数据库. 在连接之间,首先要确认你电脑上面都安装了mysql数据库. 其次,就是jdbc连接数据时候所使用 ...
- POJ 1321 简单dfs
1.POJ 1321 棋盘问题 2.总结: 题意:给定棋盘上放k个棋子,要求同行同列都不重. #include<iostream> #include<cstring> #in ...
- tomcat、Linux服务器
tomcat.Linux服务器 用到的命令 解压命令: tar -zxvf 文件名 配置 : vi /etc/profile 按 i 进入 ...
- not only ... but also
轉載自http://210.240.55.2/~t311/moe/engb6/b6grammar/b6notonly.htm not only ... but also ... 是「不僅‧‧‧也是‧‧ ...
- Linux 常见的单词缩写
命令缩写:ls:list(列出目录内容)cd:Change Directory(改变目录) su:switch user 切换用户 rpm:redhat package manager 红帽子打包管理 ...
- linux下创建,删除,移动文件命令
创建文件:touch + filename 删除文件:rm + filename 复制文件:cp + filename + dirname 移动文件:mv + filename + dirname 注 ...
- java分享第五天(数组)
1 声明数组变量: double[] mylist; or double mylist[]; 2 创建数组: 可以通过使用new运算符使用以下语法创建一个数组: arrayRefVar=new ...