首页 > 代码库 > 扩展Codeigniter控制器
扩展Codeigniter控制器
<?php class MY_Controller extends CI_Controller { public function __construct() { parent::__construct(); if(intval($this->session->userdata(‘id‘)) == 0) redirect(site_url(‘login/index‘)); } //前台加载视图方法 public function _template($template, $data = http://www.mamicode.com/array()){"current">‘; $config[‘cur_tag_close‘] = ‘</span>‘; // $config[‘num_tag_open‘] = ‘<a>‘; // $config[‘num_tag_close‘] = ‘</a>‘; $this->pagination->initialize($config); //return $this->pagination->create_links(); } /** * um 加载编辑器 百度 * @param [string] $info [须要默认显示的内容] * @param integer $width [宽度] * @param integer $height [调试] * @return string[type] [返回内容] */ public function um($info,$name="content",$width=800,$height=300) { $um = ‘‘; $um .= ‘<link href="http://www.mamicode.com/source/um/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">‘; $um .= ‘<script type="text/javascript" src="http://www.mamicode.com/source/um/third-party/jquery.min.js"></script>‘; $um .= ‘<script type="text/javascript" charset="utf-8" src="http://www.mamicode.com/source/um/umeditor.config.js"></script>‘; $um .= ‘<script type="text/javascript" charset="utf-8" src="http://www.mamicode.com/source/um/umeditor.min.js"></script>‘; $um .= ‘<script type="text/javascript" src="http://www.mamicode.com/source/um/lang/zh-cn/zh-cn.js"></script>‘; $um .= ‘<script type="text/plain" id="myEditor" name="‘.$name.‘" style="width:‘.$width.‘px;height:‘.$height.‘px;"><p>‘.$info.‘</p></script>‘; $um .= ‘<script type="text/javascript">var um = UM.getEditor("myEditor"); </script>‘; return $um; } } /** * @author [author] <[solon.ring2011@gmail.com]> * /admin/core/MY_Controller.php */
扩展Codeigniter控制器
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。