>[info] #### 视图主要是用来呈现页面效果的
## 将页面整合到框架里
>[info] 1、复制 assets文件夹,到 ```public/static``` 目录下面,如图:
![](https://box.kancloud.cn/6e65c7cc62be65ab7de8f3ab076be671_235x318.png)
>[info] 2、这个小功能一共有6个页面。如图:
![](https://box.kancloud.cn/847f611fa28db89be533e921acbb3894_461x532.png)
> (1)网站首页,位于:```application\index\view\index\index.html```;
##### 代码如下:
```
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>首页</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="描述" name="description" />
<meta name="keyword" content="基于ThinkPHP5.1的各项小功能代码实现" />
<meta name="author" content="ye21st" />
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="__STATIC__/assets/global/plugins/googleapis/googleapis.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN THEME GLOBAL STYLES -->
<link href="__STATIC__/assets/global/css/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
<link href="__STATIC__/assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME GLOBAL STYLES -->
<!-- BEGIN THEME LAYOUT STYLES -->
<link href="__STATIC__/assets/layouts/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/layouts/layout/css/themes/blue.min.css" rel="stylesheet" type="text/css" id="style_color" />
<link href="__STATIC__/assets/layouts/layout/css/custom.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME LAYOUT STYLES -->
<link rel="shortcut icon" href="favicon.ico" />
</head>
<!-- END HEAD -->
<body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white">
<div class="page-wrapper">
{include file="common/header"}
<!-- BEGIN HEADER & CONTENT DIVIDER -->
<div class="clearfix"> </div>
<!-- END HEADER & CONTENT DIVIDER -->
<!-- BEGIN CONTAINER -->
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper">
<!-- BEGIN SIDEBAR -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<div class="page-sidebar navbar-collapse collapse">
<!-- BEGIN SIDEBAR MENU -->
<!-- DOC: Apply "page-sidebar-menu-light" class right after "page-sidebar-menu" to enable light sidebar menu style(without borders) -->
<!-- DOC: Apply "page-sidebar-menu-hover-submenu" class right after "page-sidebar-menu" to enable hoverable(hover vs accordion) sub menu mode -->
<!-- DOC: Apply "page-sidebar-menu-closed" class right after "page-sidebar-menu" to collapse("page-sidebar-closed" class must be applied to the body element) the sidebar sub menu mode -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Set data-keep-expand="true" to keep the submenues expanded -->
<!-- DOC: Set data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<ul class="page-sidebar-menu page-header-fixed " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200" style="padding-top: 20px">
<!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below "sidebar-toggler-wrapper" LI element -->
<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
<li class="sidebar-toggler-wrapper hide">
<div class="sidebar-toggler">
<span></span>
</div>
</li>
<li class="heading">
<h3 class="uppercase">首页</h3>
</li>
<!-- END SIDEBAR TOGGLER BUTTON -->
<li class="nav-item start active open">
<a href="" class="nav-link nav-toggle">
<i class="icon-home"></i>
<span class="title">首页</span>
<span class="selected"></span>
</a>
</li>
<!--<li class="heading">
<h3 class="uppercase">Features</h3>
</li>-->
<!--栏目管理-->
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-diamond"></i>
<span class="title">栏目管理</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="{:url('index/cate/add')}" class="nav-link ">
<span class="title">添加栏目</span>
</a>
</li>
<li class="nav-item ">
<a href="{:url('index/cate/lst')}" class="nav-link ">
<span class="title">查看栏目</span>
</a>
</li>
</ul>
</li>
</ul>
<!-- END SIDEBAR MENU -->
<!-- END SIDEBAR MENU -->
</div>
<!-- END SIDEBAR -->
</div>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<!-- BEGIN CONTENT BODY -->
<div class="page-content">
<!-- BEGIN PAGE HEADER-->
<!-- BEGIN PAGE BAR -->
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<a href="{:url('index/index/index')}">首页</a>
<i class="fa fa-circle"></i>
</li>
</ul>
</div>
<!-- END PAGE BAR -->
<!-- BEGIN PAGE TITLE-->
<h1 class="page-title"> 欢迎来到首页
</h1>
<!-- END PAGE TITLE-->
<!-- END PAGE HEADER-->
<div class="note note-info">
<p> 这一章节,主要是讲无限极分类的应用。 </p>
</div>
</div>
<!-- END CONTENT BODY -->
</div>
<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
{include file="common/footer"}
</div>
<!--[if lt IE 9]>
<script src="__STATIC__/assets/global/plugins/respond.min.js"></script>
<script src="__STATIC__/assets/global/plugins/excanvas.min.js"></script>
<script src="__STATIC__/assets/global/plugins/ie8.fix.min.js"></script>
<![endif]-->
<!-- BEGIN CORE PLUGINS -->
<script src="__STATIC__/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN THEME GLOBAL SCRIPTS -->
<script src="__STATIC__/assets/global/scripts/app.min.js" type="text/javascript"></script>
<!-- END THEME GLOBAL SCRIPTS -->
<!-- BEGIN THEME LAYOUT SCRIPTS -->
<script src="__STATIC__/assets/layouts/layout/scripts/layout.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/layout/scripts/demo.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/global/scripts/quick-sidebar.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/global/scripts/quick-nav.min.js" type="text/javascript"></script>
<!-- END THEME LAYOUT SCRIPTS -->
</body>
</html>
```
如图所示:
![](https://box.kancloud.cn/202ba42616847b74a5cb99396a5e6b84_1339x644.png)
(2)栏目列表页,位于:```application\index\view\cate\lst.html```;
代码如下:
```
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>栏目列表 - 查看栏目</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="描述" name="description" />
<meta name="keyword" content="关键词" />
<meta name="author" content="作者" />
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="__STATIC__/assets/global/plugins/googleapis/googleapis.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN THEME GLOBAL STYLES -->
<link href="__STATIC__/assets/global/css/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
<link href="__STATIC__/assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME GLOBAL STYLES -->
<!-- BEGIN THEME LAYOUT STYLES -->
<link href="__STATIC__/assets/layouts/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/layouts/layout/css/themes/blue.min.css" rel="stylesheet" type="text/css" id="style_color" />
<link href="__STATIC__/assets/layouts/layout/css/custom.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME LAYOUT STYLES -->
<link rel="shortcut icon" href="favicon.ico" /> </head>
<!-- END HEAD -->
<body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white">
<div class="page-wrapper">
{include file="common/header"}
<!-- BEGIN HEADER & CONTENT DIVIDER -->
<div class="clearfix"> </div>
<!-- END HEADER & CONTENT DIVIDER -->
<!-- BEGIN CONTAINER -->
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper">
<!-- BEGIN SIDEBAR -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<div class="page-sidebar navbar-collapse collapse">
<!-- BEGIN SIDEBAR MENU -->
<!-- DOC: Apply "page-sidebar-menu-light" class right after "page-sidebar-menu" to enable light sidebar menu style(without borders) -->
<!-- DOC: Apply "page-sidebar-menu-hover-submenu" class right after "page-sidebar-menu" to enable hoverable(hover vs accordion) sub menu mode -->
<!-- DOC: Apply "page-sidebar-menu-closed" class right after "page-sidebar-menu" to collapse("page-sidebar-closed" class must be applied to the body element) the sidebar sub menu mode -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Set data-keep-expand="true" to keep the submenues expanded -->
<!-- DOC: Set data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<ul class="page-sidebar-menu page-header-fixed " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200" style="padding-top: 20px">
<!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below "sidebar-toggler-wrapper" LI element -->
<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
<li class="sidebar-toggler-wrapper hide">
<div class="sidebar-toggler">
<span></span>
</div>
</li>
<li class="heading">
<h3 class="uppercase">首页</h3>
</li>
<!-- END SIDEBAR TOGGLER BUTTON -->
<li class="nav-item start">
<a href="" class="nav-link nav-toggle">
<i class="icon-home"></i>
<span class="title">首页</span>
<span class="selected"></span>
</a>
</li>
<!--<li class="heading">
<h3 class="uppercase">Features</h3>
</li>-->
<!--栏目管理-->
<li class="nav-item active open">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-diamond"></i>
<span class="title">栏目管理</span>
<span class="arrow open"></span>
<span class="selected"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="{:url('index/cate/add')}" class="nav-link ">
<span class="title">添加栏目</span>
</a>
</li>
<li class="nav-item open">
<a href="{:url('index/cate/lst')}" class="nav-link ">
<span class="title">查看栏目</span>
</a>
</li>
</ul>
</li>
</ul>
<!-- END SIDEBAR MENU -->
<!-- END SIDEBAR MENU -->
</div>
<!-- END SIDEBAR -->
</div>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<!-- BEGIN CONTENT BODY -->
<div class="page-content">
<!-- BEGIN PAGE HEADER-->
<!-- BEGIN PAGE BAR -->
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<a href="{:url('index/index/index')}">首页</a>
<i class="fa fa-circle"></i>
</li>
<li>
<a href="{:url('index/cate/index')}">栏目管理</a>
<i class="fa fa-circle"></i>
</li>
</ul>
</div>
<!-- END PAGE BAR -->
<!-- BEGIN PAGE TITLE-->
<h1 class="page-title"> 栏目列表</h1>
<!-- END PAGE TITLE-->
<a href="{:url('index/cate/add')}" style="margin-bottom: 10px" class="btn green">添加</a>
<div class="row">
<div class="col-md-12">
<div class="portlet box green">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-cogs"></i>栏目列表</div>
</div>
<div class="portlet-body flip-scroll">
<form action="" method="post">
<table class="table table-bordered table-striped table-condensed flip-content">
<thead class="flip-content">
<tr>
<th width="20%"> ID </th>
<th> 排序 </th>
<th class="numeric"> 栏目名称 </th>
<th class="numeric"> 操作 </th>
</tr>
</thead>
<tbody>
{volist name="cateres" id="cate"}
<tr>
<td> {$cate.id} </td>
<td width="20%">
<input name="{$cate.id}" type="text" class="form-control input-sm" placeholder="排序" value="{$cate.sort}">
</td>
<td class="numeric"> {if condition="$cate['level'] neq 0"}|{/if}<?php echo str_repeat('-', $cate['level']*8)?>{$cate.catename} </td>
<td class="numeric">
<a href="{:url('index/cate/edit',array('id'=>$cate['id']))}" class="btn btn-sm blue"> 编辑
<i class="fa fa-edit"></i>
</a>
<a href="{:url('index/cate/del',array('id'=>$cate['id']))}" onClick="return del();" class="btn btn-sm red"> 删除
<i class="fa fa-trash-o"></i>
</a>
</td>
</tr>
{/volist}
<tr>
<td></td>
<td>
<input class="btn btn-primary btn-sm shiny" style="margin-left:224px; margin-top:10px;text-align: center" type="submit" value="排序" >
</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- END CONTENT BODY -->
</div>
<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
{include file="common/footer"}
</div>
<!--[if lt IE 9]>
<script src="__STATIC__/assets/global/plugins/respond.min.js"></script>
<script src="__STATIC__/assets/global/plugins/excanvas.min.js"></script>
<script src="__STATIC__/assets/global/plugins/ie8.fix.min.js"></script>
<![endif]-->
<!-- BEGIN CORE PLUGINS -->
<script src="__STATIC__/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN THEME GLOBAL SCRIPTS -->
<script src="__STATIC__/assets/global/scripts/app.min.js" type="text/javascript"></script>
<!-- END THEME GLOBAL SCRIPTS -->
<!-- BEGIN THEME LAYOUT SCRIPTS -->
<script src="__STATIC__/assets/layouts/layout/scripts/layout.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/layout/scripts/demo.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/global/scripts/quick-sidebar.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/global/scripts/quick-nav.min.js" type="text/javascript"></script>
<!-- END THEME LAYOUT SCRIPTS -->
<script>
$(document).ready(function()
{
function del()
{
if(confirm("确定要删除吗?"))
{
return true;
}
else
{
return false;
}
}
})
</script>
</body>
</html>
```
如图所示:
![](https://box.kancloud.cn/19526472ae04a2584206279b98e250b4_1340x650.png)
(3)栏目添加页,位于:```application\index\view\cate\add.html```;
代码如下:
```
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>添加栏目 - 栏目管理</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="描述" name="description" />
<meta name="keyword" content="关键词" />
<meta name="author" content="作者" />
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="__STATIC__/assets/global/plugins/googleapis/googleapis.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN THEME GLOBAL STYLES -->
<link href="__STATIC__/assets/global/css/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
<link href="__STATIC__/assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME GLOBAL STYLES -->
<!-- BEGIN THEME LAYOUT STYLES -->
<link href="__STATIC__/assets/layouts/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/layouts/layout/css/themes/blue.min.css" rel="stylesheet" type="text/css" id="style_color" />
<link href="__STATIC__/assets/layouts/layout/css/custom.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME LAYOUT STYLES -->
<link rel="shortcut icon" href="favicon.ico" />
</head>
<!-- END HEAD -->
<body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white">
<div class="page-wrapper">
{include file="common/header"}
<!-- BEGIN HEADER & CONTENT DIVIDER -->
<div class="clearfix"> </div>
<!-- END HEADER & CONTENT DIVIDER -->
<!-- BEGIN CONTAINER -->
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper">
<!-- BEGIN SIDEBAR -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<div class="page-sidebar navbar-collapse collapse">
<!-- BEGIN SIDEBAR MENU -->
<!-- DOC: Apply "page-sidebar-menu-light" class right after "page-sidebar-menu" to enable light sidebar menu style(without borders) -->
<!-- DOC: Apply "page-sidebar-menu-hover-submenu" class right after "page-sidebar-menu" to enable hoverable(hover vs accordion) sub menu mode -->
<!-- DOC: Apply "page-sidebar-menu-closed" class right after "page-sidebar-menu" to collapse("page-sidebar-closed" class must be applied to the body element) the sidebar sub menu mode -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Set data-keep-expand="true" to keep the submenues expanded -->
<!-- DOC: Set data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<ul class="page-sidebar-menu page-header-fixed " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200" style="padding-top: 20px">
<!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below "sidebar-toggler-wrapper" LI element -->
<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
<li class="sidebar-toggler-wrapper hide">
<div class="sidebar-toggler">
<span></span>
</div>
</li>
<li class="heading">
<h3 class="uppercase">首页</h3>
</li>
<!-- END SIDEBAR TOGGLER BUTTON -->
<li class="nav-item start">
<a href="" class="nav-link nav-toggle">
<i class="icon-home"></i>
<span class="title">首页</span>
<span class="selected"></span>
</a>
</li>
<!--<li class="heading">
<h3 class="uppercase">Features</h3>
</li>-->
<!--栏目管理-->
<li class="nav-item active open">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-diamond"></i>
<span class="title">栏目管理</span>
<span class="arrow open"></span>
<span class="selected"></span>
</a>
<ul class="sub-menu">
<li class="nav-item open">
<a href="{:url('index/cate/add')}" class="nav-link ">
<span class="title">添加栏目</span>
</a>
</li>
<li class="nav-item">
<a href="{:url('index/cate/lst')}" class="nav-link ">
<span class="title">查看栏目</span>
</a>
</li>
</ul>
</li>
</ul>
<!-- END SIDEBAR MENU -->
<!-- END SIDEBAR MENU -->
</div>
<!-- END SIDEBAR -->
</div>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<!-- BEGIN CONTENT BODY -->
<div class="page-content">
<!-- BEGIN PAGE HEADER-->
<!-- BEGIN PAGE BAR -->
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<a href="{:url('index/index/index')}">首页</a>
<i class="fa fa-circle"></i>
</li>
<li>
<a href="{:url('index/cate/lst')}">栏目管理</a>
<i class="fa fa-circle"></i>
</li>
<li>
<a>添加栏目</a>
</li>
</ul>
</div>
<!-- END PAGE BAR -->
<!-- BEGIN PAGE TITLE-->
<h1 class="page-title"> 添加栏目</h1>
<!-- END PAGE TITLE-->
<div class="row">
<div class="col-md-12">
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-green-haze">
<i class="icon-settings font-green-haze"></i>
<span class="caption-subject bold uppercase"> 添加栏目</span>
</div>
</div>
<div class="portlet-body form">
<form action="" method="post" role="form" class="form-horizontal">
<div class="form-body">
<div class="form-group form-md-line-input">
<label class="col-md-2 control-label" for="pid">上级栏目</label>
<div class="col-md-10">
<select name="pid" class="form-control" id="pid">
<option value="0">顶级栏目</option>
{volist name="cateres" id="cate"}
<option value="{$cate.id}">{if condition="$cate['level'] neq 0"}|{/if}<?php echo str_repeat('-', $cate['level']*4)?>{$cate.catename}</option>
{/volist}
</select>
<div class="form-control-focus"> </div>
</div>
</div>
<div class="form-group form-md-line-input">
<label class="col-md-2 control-label" for="catename">栏目名称</label>
<div class="col-md-10">
<input name="catename" type="text" class="form-control" id="catename" placeholder="输入你的栏目名称">
<div class="form-control-focus"> </div>
</div>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn blue">保存信息</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- END CONTENT BODY -->
</div>
<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
{include file="common/footer"}
</div>
<!--[if lt IE 9]>
<script src="__STATIC__/assets/global/plugins/respond.min.js"></script>
<script src="__STATIC__/assets/global/plugins/excanvas.min.js"></script>
<script src="__STATIC__/assets/global/plugins/ie8.fix.min.js"></script>
<![endif]-->
<!-- BEGIN CORE PLUGINS -->
<script src="__STATIC__/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN THEME GLOBAL SCRIPTS -->
<script src="__STATIC__/assets/global/scripts/app.min.js" type="text/javascript"></script>
<!-- END THEME GLOBAL SCRIPTS -->
<!-- BEGIN THEME LAYOUT SCRIPTS -->
<script src="__STATIC__/assets/layouts/layout/scripts/layout.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/layout/scripts/demo.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/global/scripts/quick-sidebar.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/global/scripts/quick-nav.min.js" type="text/javascript"></script>
<!-- END THEME LAYOUT SCRIPTS -->
</body>
</html>
```
如图所示:
![](https://box.kancloud.cn/aa4e7cd88bdc0e1692ac213b9a7e1ea1_1338x650.png)
(4)栏目修改页,位于:```application\index\view\cate\edit.html```;
代码如下:
```
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>修改栏目 - 栏目管理</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="描述" name="description" />
<meta name="keyword" content="关键词" />
<meta name="author" content="作者" />
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="__STATIC__/assets/global/plugins/googleapis/googleapis.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN THEME GLOBAL STYLES -->
<link href="__STATIC__/assets/global/css/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
<link href="__STATIC__/assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME GLOBAL STYLES -->
<!-- BEGIN THEME LAYOUT STYLES -->
<link href="__STATIC__/assets/layouts/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/assets/layouts/layout/css/themes/blue.min.css" rel="stylesheet" type="text/css" id="style_color" />
<link href="__STATIC__/assets/layouts/layout/css/custom.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME LAYOUT STYLES -->
<link rel="shortcut icon" href="favicon.ico" />
</head>
<!-- END HEAD -->
<body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white">
<div class="page-wrapper">
{include file="common/header"}
<!-- BEGIN HEADER & CONTENT DIVIDER -->
<div class="clearfix"> </div>
<!-- END HEADER & CONTENT DIVIDER -->
<!-- BEGIN CONTAINER -->
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper">
<!-- BEGIN SIDEBAR -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<div class="page-sidebar navbar-collapse collapse">
<!-- BEGIN SIDEBAR MENU -->
<!-- DOC: Apply "page-sidebar-menu-light" class right after "page-sidebar-menu" to enable light sidebar menu style(without borders) -->
<!-- DOC: Apply "page-sidebar-menu-hover-submenu" class right after "page-sidebar-menu" to enable hoverable(hover vs accordion) sub menu mode -->
<!-- DOC: Apply "page-sidebar-menu-closed" class right after "page-sidebar-menu" to collapse("page-sidebar-closed" class must be applied to the body element) the sidebar sub menu mode -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Set data-keep-expand="true" to keep the submenues expanded -->
<!-- DOC: Set data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<ul class="page-sidebar-menu page-header-fixed " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200" style="padding-top: 20px">
<!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below "sidebar-toggler-wrapper" LI element -->
<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
<li class="sidebar-toggler-wrapper hide">
<div class="sidebar-toggler">
<span></span>
</div>
</li>
<li class="heading">
<h3 class="uppercase">首页</h3>
</li>
<!-- END SIDEBAR TOGGLER BUTTON -->
<li class="nav-item start">
<a href="" class="nav-link nav-toggle">
<i class="icon-home"></i>
<span class="title">首页</span>
<span class="selected"></span>
</a>
</li>
<!--<li class="heading">
<h3 class="uppercase">Features</h3>
</li>-->
<!--栏目管理-->
<li class="nav-item active open">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-diamond"></i>
<span class="title">栏目管理</span>
<span class="arrow open"></span>
<span class="selected"></span>
</a>
<ul class="sub-menu">
<li class="nav-item open">
<a href="{:url('index/cate/add')}" class="nav-link ">
<span class="title">添加栏目</span>
</a>
</li>
<li class="nav-item">
<a href="{:url('index/cate/index')}" class="nav-link ">
<span class="title">查看栏目</span>
</a>
</li>
</ul>
</li>
</ul>
<!-- END SIDEBAR MENU -->
<!-- END SIDEBAR MENU -->
</div>
<!-- END SIDEBAR -->
</div>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<!-- BEGIN CONTENT BODY -->
<div class="page-content">
<!-- BEGIN PAGE HEADER-->
<!-- BEGIN PAGE BAR -->
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<a href="{:url('index/index/index')}">首页</a>
<i class="fa fa-circle"></i>
</li>
<li>
<a href="{:url('index/cate/lst')}">栏目管理</a>
<i class="fa fa-circle"></i>
</li>
<li>
<a>修改栏目</a>
</li>
</ul>
</div>
<!-- END PAGE BAR -->
<!-- BEGIN PAGE TITLE-->
<h1 class="page-title"> 修改栏目</h1>
<!-- END PAGE TITLE-->
<div class="row">
<div class="col-md-12">
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-green-haze">
<i class="icon-settings font-green-haze"></i>
<span class="caption-subject bold uppercase"> 修改栏目</span>
</div>
</div>
<div class="portlet-body form">
<form action="" method="post" role="form" class="form-horizontal">
<input type="hidden" name="id" value="{$cates.id}" />
<div class="form-body">
<div class="form-group form-md-line-input">
<label class="col-md-2 control-label" for="pid">上级栏目</label>
<div class="col-md-10">
<select name="pid" class="form-control" id="pid">
<option value="0">顶级栏目</option>
{volist name="cateres" id="cate"}
<option {if condition="$cates['pid'] eq $cate['id']"}selected="selected"{/if} value="{$cate.id}">{if condition="$cate['level'] neq 0"}|{/if}<?php echo str_repeat('-', $cate['level']*4)?>{$cate.catename}</option>
{/volist}
</select>
<div class="form-control-focus"> </div>
</div>
</div>
<div class="form-group form-md-line-input">
<label class="col-md-2 control-label" for="catename">栏目名称</label>
<div class="col-md-10">
<input name="catename" type="text" class="form-control" id="catename" placeholder="输入你的栏目名称" value="{$cates.catename}">
<div class="form-control-focus"> </div>
</div>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn blue">保存信息</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- END CONTENT BODY -->
</div>
<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
{include file="common/footer"}
</div>
<!--[if lt IE 9]>
<script src="__STATIC__/assets/global/plugins/respond.min.js"></script>
<script src="__STATIC__/assets/global/plugins/excanvas.min.js"></script>
<script src="__STATIC__/assets/global/plugins/ie8.fix.min.js"></script>
<![endif]-->
<!-- BEGIN CORE PLUGINS -->
<script src="__STATIC__/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN THEME GLOBAL SCRIPTS -->
<script src="__STATIC__/assets/global/scripts/app.min.js" type="text/javascript"></script>
<!-- END THEME GLOBAL SCRIPTS -->
<!-- BEGIN THEME LAYOUT SCRIPTS -->
<script src="__STATIC__/assets/layouts/layout/scripts/layout.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/layout/scripts/demo.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/global/scripts/quick-sidebar.min.js" type="text/javascript"></script>
<script src="__STATIC__/assets/layouts/global/scripts/quick-nav.min.js" type="text/javascript"></script>
<!-- END THEME LAYOUT SCRIPTS -->
</body>
</html>
```
如图所示:
![](https://box.kancloud.cn/7c1570cbdaf3cb8c3ff72f2b9ac437c5_1338x646.png)
(5)公共头部,位于:```application\index\view\common\header.html```;
代码如下:
```
<!-- BEGIN HEADER -->
<div class="page-header navbar navbar-fixed-top">
<!-- BEGIN HEADER INNER -->
<div class="page-header-inner ">
<!-- BEGIN LOGO -->
<div class="page-logo">
<a href="{:url('index/index/index')}">
<span style="line-height: 50px;color: #FFF">无限极分类</span>
</a>
<div class="menu-toggler sidebar-toggler">
<span></span>
</div>
</div>
<!-- END LOGO -->
<!-- BEGIN RESPONSIVE MENU TOGGLER -->
<a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse">
<span></span>
</a>
<!-- END RESPONSIVE MENU TOGGLER -->
<!-- BEGIN TOP NAVIGATION MENU -->
<div class="top-menu">
<ul class="nav navbar-nav pull-right">
<!-- BEGIN USER LOGIN DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-user">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<img alt="" class="img-circle" src="__STATIC__/assets/layouts/layout/img/avatar3_small.jpg" />
<span class="username username-hide-on-mobile"> admin </span>
<i class="fa fa-sign-out"></i>
</a>
</li>
<!-- END USER LOGIN DROPDOWN -->
</ul>
</div>
<!-- END TOP NAVIGATION MENU -->
</div>
<!-- END HEADER INNER -->
</div>
<!-- END HEADER -->
```
如图所示:
![](https://box.kancloud.cn/d2f76f5f3eef39ea8a0892f8b1a4468d_1342x36.png)
(6)公共底部,位于:```application\index\view\common\footer.html```;
代码如下:
```
<!-- BEGIN FOOTER -->
<div class="page-footer">
<div class="page-footer-inner">
<a target="_blank" style="color: #FFF" href="https://www.kancloud.cn/ifeng/tp5_1_code">基于ThinkPHP5.1的各项小功能代码实现</a>
</div>
<div class="scroll-to-top">
<i class="icon-arrow-up"></i>
</div>
</div>
<!-- END FOOTER -->
```
如图所示:
![](https://box.kancloud.cn/549b937fc757885497af03de7fa41281_1343x19.png)
>[danger] 注意:页面如果要正常显示,那么需要同时完成下面的模型以及控制器,这样,可以进行完整的显示以及操作。
>[info] 至此,首页、栏目相关的页面、公共页面也就制作好了,正常访问请下载源码查看演示效果,以上是主要代码。
- 序言
- 文档更新状态
- 错误提交
- 零、前期准备
- (1)PHP开发环境
- (2)PHP开发工具
- (3)数据库相关
- (4)ThinkPHP5.1完全开发手册
- (5)URL优化
- 一、用户登录
- (1)数据表设计
- (2)项目配置
- (3)MVC - V(视图)
- (4)MVC - M(模型)
- (5)MVC - C(控制器)
- (6)源码下载
- 二、无限极分类
- (1)数据表设计
- (2)项目配置
- (3)MVC - V(视图)
- (4)MVC - M(模型)
- (5)验证器
- (6)MVC - C(控制器)
- (7)源码下载
- 三、TP5.1开发API接口,实现前后端分离
- (1)数据表设计
- (2)项目配置
- (3)HTML纯静态页面
- (4)MVC - M(模型)
- (5)MVC - C(控制器)
- (6)源码下载
- 四、TP5调用 API 接口
- (1)项目配置
- (2)MVC - V(视图)
- (3)MVC - C(控制器)
- (4)源码下载
- 五、文章分页以及修改分页样式
- (1)数据表设计
- (2)项目配置
- (3)MVC - V(视图)
- (4)MVC - M(模型)
- (5)MVC - C(控制器)
- (6)自定义分页类
- (7)源码下载
- 六、修改默认跳转页面
- (1)数据表设计
- (2)项目配置
- (3)MVC - V(视图)
- (4)MVC - M(模型)
- (5)验证器
- (6)MVC - C(控制器)
- (7)自定义跳转页面
- (8)源码下载
- 七、整合markdown在线编辑器
- (1)数据表设计
- (2)项目配置
- (3)MVC - V(视图)
- (4)MVC - C(控制器)
- (5)源码下载
- 八、整合PHPExcel导入导出功能
- (1)数据表设计
- (2)项目配置
- (3)MVC - V(视图)
- (4)MVC - C(控制器)
- (5)源码下载
- 九、整合Echarts
- (1)数据表设计
- (2)项目配置
- (3)MVC - V(视图)
- (4)MVC - C(控制器)
- (5)源码下载
- 十、接入AntV G2(可视化图形)
- (1)数据表设计
- (2)项目配置
- (3)MVC - V(视图)
- (4)MVC - C(控制器)
- (5)源码下载