YII框架页面使用frameset布局(一)

1.下载模版http://pan.baidu.com/s/1mgLtvzq

2.protected\views\index,新建index.php,head.php,left.php,right.php,将后台对应的HTML文件内容复制进去

3.assets\default中新建css,images,js三个文件夹,将对应的css,js和图片文件复制进去

4.protected\config中新建constant.php

<?php
/*设置系统常量*/
define('SITE_URL','http://这里写当前域名/');

define('CSS_URL',SITE_URL."assets/default/css");
define('IMG_URL',SITE_URL."assets/default/images");
?>

5.根目录下index.php中

require_once($yii);
前,增加
require_once (dirname(__FILE__).'/protected/config/constant.php');
6.将head.php,left.php,right.php中的CSS路径替换为 <?php echo CSS_URL; ?>,如: <?php echo CSS_URL; ?>/admin.css

图片路径替换为<?php echo IMG_URL; ?>,如:<?php echo IMG_URL; ?>/header_right.jpg

css文件中的"../img"替换为"../images"

7.将index.php中的

"head.html"替换为"./index.php?r=index/head"

"left.html"替换为"./index.php?r=index/left"

"right.html"替换为"./index.php?r=index/right"

8.新建IndexController.php,

<?php
class IndexController extends Controller{
	function actionIndex(){
		//通过控制器方法调用视图
		$this->renderPartial('index');
	}
	
	function actionHead(){
		$this->renderPartial('head');
	}
	
	function actionLeft(){
		$this->renderPartial('left');
	}

	function actionRight(){
		$this->renderPartial('right');
	}
}
?>
完成,效果如下:


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值