清风徐来
知是行之始,行是知之成

CodeIgniter中框架的使用

PHP CodeIgniter 约 1 分钟

控制器代码:

class Admin extents Control
{
    function index() {
        $this->load->view('admin/index');
    }
    function top() {
        $this->load->view('admin/top');
    }
    function menu() {
        $this->load->view('admin/menu');
    }
    function main() {
        $this->load->view('admin/main');
    }
    function bottom() {
        $this->load->view('admin/bottom');
    }
}

views文件夹下有个专门的admin文件夹,里面都是管理页面(index.php , top.php , menu.php , main.php , bottom.php)

index.php内容如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Administrator’s control panel</title>
</head>

<frameset rows="60,*,27" frameborder="no" border="0" framespacing="0">   
  <frame src="<?php echo site_url("admin/top") ?>" name="topFrame" scrolling="no">   
  <frameset rows="*" cols="0,*" name="ecc" framespacing="0" frameborder="no" border="0">   
    <frame src="<?php echo site_url("admin/menu") ?>" name="mainFrame" border="0" scrolling="no">   
    <frame src="<?php echo site_url("admin/main") ?>" name="rightFrame" scrolling="auto">   
  </frameset>   
  <frame src="<?php echo site_url("admin/bottom") ?>" name="bottomFrame" scrolling="no">   
</frameset>
<noframes><body>
</body>
</noframes></html>