基于YIi的三栏frameset框架后台管理页面的实现
2013-07-03 15:26
489 查看
基于YIi的三栏frameset框架后台管理页面的实现
http://love19820823.iteye.com/blog/1302825
前段时间和大家讨论过 yii后台管理页面结构实现方法的问题,现在我的项目接近收尾,向大家分享一下我的后台管理页面实现,
就是那种常见的frameset三栏布局,主要代码如下:
SiteController.php
<?php
class SiteController extends CController
{
/**
* Declares class-based actions.
*/
public function actions()
{
return array(
// captcha action renders the CAPTCHA image
// this is used by the contact page
'captcha'=>array(
'class'=>'CCaptchaAction',
'backColor'=>0xEBF4FB,
),
);
}
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
// renders the view file 'protected/views/site/index.php'
// using the default layout 'protected/views/layouts/main.php'
//注意运行yiic shell前需要改回$this->render('index'); 否则无法进入shell
$this->render('index');
}
/**
* Displays the contact page
*/
public function actionContact()
{
$contact=new ContactForm;
if(isset($_POST['ContactForm']))
{
$contact->attributes=$_POST['ContactForm'];
if($contact->validate())
{
$headers="From: {$contact->email}/r/nReply-To: {$contact->email}";
mail(Yii::app()->params['adminEmail'],$contact->subject,$contact->body,$headers);
Yii::app()->user->setFlash('contact','Thank you for contacting us. We will respond to you as soon as possible.');
$this->refresh();
}
}
$this->render('contact',array('contact'=>$contact));
}
/**
* Displays the login page
*/
public function actionLogin()
{
$form=new LoginForm;
// collect user input data
if(isset($_POST['LoginForm']))
{
$form->attributes=$_POST['LoginForm'];
// validate user input and redirect to previous page if valid
if($form->validate())
$this->redirect(Yii::app()->user->returnUrl);
}
// display the login form
$this->layout='login';
$this->render('login',array('form'=>$form));
}
/**
* Logout the current user and redirect to homepage.
*/
public function actionLogout()
{
Yii::app()->user->logout();
$this->redirect(Yii::app()->homeUrl);
}
/**
* 管理框架页
*/
public function actionDefault()
{
if(Yii::app()->user->isGuest){
$this->redirect(array('site/login'));
}
else{
$this->renderPartial('default');
}
}
/**
* 管理框架页 Head
*/
public function actionHead()
{
if(Yii::app()->user->isGuest){
$this->redirect(array('site/login'));
}
else{
$this->renderPartial('head');
}
}
/**
* 管理框架页 left
*/
public function actionLeft()
{
if(Yii::app()->user->isGuest){
$this->redirect(array('site/login'));
}
else{
Yii::app()->getClientScript()->registerCoreScript('jquery');
$this->layout='left';
$this->render('left');
}
}
}
views/site/default.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="92,*" cols="*" frameborder="no" border="0" framespacing="0">
<frame src="<?php echo Yii::app()->request->baseUrl; ?>/index.php/site/head" name="topFrame" scrolling="no" noresize="noresize" id="topFrame" />
<frameset cols="215,*" frameborder="no" border="0" framespacing="0">
<frame src="<?php echo Yii::app()->request->baseUrl; ?>/index.php/site/left" scrolling="no" noresize="noresize" id="leftFrame" />
<frame src="" name="mainFrame" id="mainFrame" />
</frameset>
</frameset>
<noframes><body>
</body>
</noframes></html>
http://love19820823.iteye.com/blog/1302825
前段时间和大家讨论过 yii后台管理页面结构实现方法的问题,现在我的项目接近收尾,向大家分享一下我的后台管理页面实现,
就是那种常见的frameset三栏布局,主要代码如下:
SiteController.php
<?php
class SiteController extends CController
{
/**
* Declares class-based actions.
*/
public function actions()
{
return array(
// captcha action renders the CAPTCHA image
// this is used by the contact page
'captcha'=>array(
'class'=>'CCaptchaAction',
'backColor'=>0xEBF4FB,
),
);
}
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
// renders the view file 'protected/views/site/index.php'
// using the default layout 'protected/views/layouts/main.php'
//注意运行yiic shell前需要改回$this->render('index'); 否则无法进入shell
$this->render('index');
}
/**
* Displays the contact page
*/
public function actionContact()
{
$contact=new ContactForm;
if(isset($_POST['ContactForm']))
{
$contact->attributes=$_POST['ContactForm'];
if($contact->validate())
{
$headers="From: {$contact->email}/r/nReply-To: {$contact->email}";
mail(Yii::app()->params['adminEmail'],$contact->subject,$contact->body,$headers);
Yii::app()->user->setFlash('contact','Thank you for contacting us. We will respond to you as soon as possible.');
$this->refresh();
}
}
$this->render('contact',array('contact'=>$contact));
}
/**
* Displays the login page
*/
public function actionLogin()
{
$form=new LoginForm;
// collect user input data
if(isset($_POST['LoginForm']))
{
$form->attributes=$_POST['LoginForm'];
// validate user input and redirect to previous page if valid
if($form->validate())
$this->redirect(Yii::app()->user->returnUrl);
}
// display the login form
$this->layout='login';
$this->render('login',array('form'=>$form));
}
/**
* Logout the current user and redirect to homepage.
*/
public function actionLogout()
{
Yii::app()->user->logout();
$this->redirect(Yii::app()->homeUrl);
}
/**
* 管理框架页
*/
public function actionDefault()
{
if(Yii::app()->user->isGuest){
$this->redirect(array('site/login'));
}
else{
$this->renderPartial('default');
}
}
/**
* 管理框架页 Head
*/
public function actionHead()
{
if(Yii::app()->user->isGuest){
$this->redirect(array('site/login'));
}
else{
$this->renderPartial('head');
}
}
/**
* 管理框架页 left
*/
public function actionLeft()
{
if(Yii::app()->user->isGuest){
$this->redirect(array('site/login'));
}
else{
Yii::app()->getClientScript()->registerCoreScript('jquery');
$this->layout='left';
$this->render('left');
}
}
}
views/site/default.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="92,*" cols="*" frameborder="no" border="0" framespacing="0">
<frame src="<?php echo Yii::app()->request->baseUrl; ?>/index.php/site/head" name="topFrame" scrolling="no" noresize="noresize" id="topFrame" />
<frameset cols="215,*" frameborder="no" border="0" framespacing="0">
<frame src="<?php echo Yii::app()->request->baseUrl; ?>/index.php/site/left" scrolling="no" noresize="noresize" id="leftFrame" />
<frame src="" name="mainFrame" id="mainFrame" />
</frameset>
</frameset>
<noframes><body>
</body>
</noframes></html>
相关文章推荐
- 基于YIi的三栏frameset框架后台管理页面的实现
- 基于YIi的三栏frameset框架后台管理页面的实现
- 基于ssm框架的个人博客(3)--easyui后台管理页面设计
- PHP使用frameset制作后台界面时,怎样实现通过操作左边框架,使右边框架中的页面跳转?
- 一步一步实现web程序信息管理系统之二----后台框架实现跳转登陆页面
- 基于Spring的轻量级Web Service事务管理框架及其实现
- JEECG - 基于代码生成器的J2EE智能开发框架 续六: JEECG 前台页面和后台交互讲解
- 在前后端分离的项目中,后台使用shiro框架时,怎样使用它的会话管理系统(session),从而实现权限控制
- 基于SSH实现管理系统之框架整合篇
- Yii框架在页面输出执行sql语句以方便调试的实现方法
- 项目视频讲解_基于LigerUI前端技术实现的管理平台(纯静态页面,json,工作流及权限管理)
- 基于Spring的轻量级Web Service事务管理框架及其实现
- 借用 疯狂秀才 的页面,修改了一下自然框架后台管理的页面。
- 后台管理框架之六 :View页面设计
- 将不同的html页面组合成一个——通过框架标签frameset和frame实现
- 贴出使用dojo做的经典后台管理页面,这里只是个框架
- web.config中实现对后台管理必须登录(manage文件夹所有页面都要登录),但是其他页面不需要
- Jquery与Bootstrap实现后台管理页面增删改查功能示例
- Webservice_25_SOAP的基于契约优先开发用户管理_实现Jsp页面功能
- 借用 疯狂秀才 的页面,修改了一下自然框架后台管理的页面。