CI 模块化显示[仿照shopex功能]
吹牛吹上天 挂件小功能 待改进
============
/application/controllers/welcome.php
1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 2 3 class game extends CI_Controller { 4 public function index(){ 5 $this->load->helper('url'); 6 $index['title'] = "这是标题"; 7 $index['data']['1'] = array('1','2','3'); 8 $index['data']['2'] = array('11','22','33'); 9 $index['data']['3'] = array('111','222','333'); 10 $this->load->view('index',$index); 11 } 12 }
/application/views/index.php
1 <?php 2 $this->load->view('head'); 3 $this->load->view('body'); 4 $this->load->view('foot'); 5 ?>
/application/views/head.php
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="utf-8"> 5 <title><?php echo $title; ?></title> 6 </head> 7 <body>
/application/views/body.php----------------------------------------------
1 <?php 2 $id['id']=1; 3 $this->load->view('model_a',$id); 4 $id['id']=2; 5 $this->load->view('model_a',$id); 6 $id['id']=3; 7 $this->load->view('model_a',$id); 8 ?>
/application/views/foot.php
1 </body> 2 </html>