中山美 发表于 2011-9-7 11:41:11

CI 搭建后台框架

本帖最后由 中山美 于 2011-9-7 11:42 编辑

新手问题
   在我搭建后台模板时,基本上搭建是用iframe。
view[main.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>企业信息管理系统</title>
</head>

<frameset rows="98,*,8" frameborder="no" border="0" framespacing="0">
<frame src="<?php echo site_url();?>/main/top" name="topFrame" scrolling="no" noresize="noresize" id="topFrame" />
<frame src="<?php echo site_url().$tpl;?>" name="mainFrame" id="mainFrame" />
<frame src="<?php echo site_url();?>/main/down" name="bottomFrame" scrolling="no" noresize="noresize" id="bottomFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>



controllers

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller {

    /**
   * Index Page for this controller.
   *
   * Maps to the following URL
   *         http://example.com/index.php/welcome
   *    - or -
   *         http://example.com/index.php/welcome/index
   *    - or -
   * Since this controller is set as the default controller in
   * config/routes.php, it's displayed at http://example.com/
   *
   * So any other public methods not prefixed with an underscore will
   * map to /index.php/welcome/<method_name>
   * @see http://codeigniter.com/user_guide/general/urls.html
   */
    public$data;
    function __construct(){
      parent::__construct();
      $this->load->helper(array('form', 'url'));
    }
    public function index(){
      $this->data['tpl']= '/user/middel';
      $this->load->view('main',$this->data);
    }

    public function top(){
      $this->load->view('top');
    }

    public function down(){
      $this->load->view('down');
    }

    public function middel(){
      $this->load->view('middel');
    }
    public function left(){
      $this->load->view('left');
    }
    public function tab(){
      $this->load->view('tab');
    }
}



遇到de 心结:

   我是在data中指定 data['tpl'] 变量,就是指定 我要显示的view,在通过mian.php中的
   <frame src="<?php echo site_url().$tpl;?>" name="mainFrame" id="mainFrame" />
    显示出来。
   
   问题一:每次显示指定一个view ,都是刷新 views 中的main.php就相当于全部刷新页面。个人认为有点不好。

   问题二:
    在控制器中,我有一个变量 $data,能不能指定多个 views使用呢?
    就如 我在main.php 中指定 一个变量,传到 视图 main.php

    视图类似如下:
      <frame src="top.php" name="topFrame" scrolling="no" noresize="noresize" id="topFrame" />
   <frame src="conter.php" name="mainFrame" id="mainFrame" />
   <frame src="down.php" name="bottomFrame" scrolling="no" noresize="noresize"

    想问的是 ,$data能不能在top.php,conter.php,down.php中同时使用$data 变量。





   
   



jeongee 发表于 2011-9-8 09:43:53

<?php echo site_url();?>/main/top

请写成这样<?php echo site_url('main/top');?>

visvoy 发表于 2011-9-8 10:06:46

这是frameset吧,哪里有iframe?

张杰 发表于 2011-12-15 13:25:40

用表格好了,左边iframe显示菜单,菜单连接目标是右边iframe的id属性了。

qss5012 发表于 2012-6-16 10:47:27

学习了
页: [1]
查看完整版本: CI 搭建后台框架