当前位置:网站首页>Use of ThinkPHP template
Use of ThinkPHP template
2022-07-05 17:11:00 【qq_ forty-two million three hundred and seven thousand five hun】
thinkphp The template file of is placed in /home/View The template file here needs to be consistent with the name of the controller
For example, in view Create a new one in the directory Index Directory so Index The controller will call the template file of this directory
newly build Index The directory is being created index.html The contents are as follows
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Scorpio </title>
</head>
<body>
<p>helloworld</p>
</body>
</html>
rewrite IndexController.class.php Of index Method
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index(){
$this->display();
}
?>
display Method is used to call the access of template file index.php/home/index/index You can access Index Under the table of contents index.html Templates
Can be in display Add parameters to specify the template file to be accessed
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index(){
$this->display();
}
public function test(){
$this->display("index");;
}
}
When we visit index.php/home/index/test In fact, what I visited was index.html Template because we are display It specifies
Template commonly used static variables
PUBLIC It stands for /Public This directory is used to store css js Style file
/home/view/Index/index.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title> Simple general article system background management template </title>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/common.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__ /css/main.css"/>
</head>
<body>
<div class="topbar-wrap white">
<div class="topbar-inner clearfix">
<div class="topbar-logo-wrap clearfix">
<h1 class="topbar-logo none"><a href="index.html" class="navbar-brand"> Background management </a></h1>
<ul class="navbar-list clearfix">
<li><a class="on" href="index.html"> home page </a></li>
<li><a href="#" target="_blank"> homepage </a></li>
</ul>
</div>
<div class="top-info-wrap">
<ul class="top-info-list clearfix">
<li><a href="#"> Administrators </a></li>
<li><a href="#"> Change Password </a></li>
<li><a href="#"> sign out </a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="sidebar-wrap">
<div class="sidebar-title">
<h1> menu </h1>
</div>
<div class="sidebar-content">
<ul class="sidebar-list">
<li>
<a href="#"><i class="icon-font"></i> Common operations </a>
<ul class="sub-menu">
<li><a href="design.html"><i class="icon-font"></i> Work management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Blog management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Classification management </a></li>
<li><a href="design.html"><i class="icon-font"></i> message management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Comment management </a></li>
<li><a href="design.html"><i class="icon-font"></i> link </a></li>
<li><a href="design.html"><i class="icon-font"></i> Advertising management </a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-font"></i> System management </a>
<ul class="sub-menu">
<li><a href="system.html"><i class="icon-font"></i> System settings </a></li>
<li><a href="system.html"><i class="icon-font"></i> Clean cache </a></li>
<li><a href="system.html"><i class="icon-font"></i> The data backup </a></li>
<li><a href="system.html"><i class="icon-font"></i> Data restore </a></li>
</ul>
</li>
</ul>
</div>
</div>
<!--/sidebar-->
<div class="main-wrap">
<div class="crumb-wrap">
<div class="crumb-list"><i class="icon-font"></i><span> Welcome to use 『 Passion 』 Blog program , The preferred tool for Jianbo .</span></div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> shortcuts </h1>
</div>
<div class="result-content">
<div class="short-wrap">
<a href="insert.html"><i class="icon-font"></i> New works </a>
<a href="insert.html"><i class="icon-font"></i> The new post </a>
<a href="insert.html"><i class="icon-font"></i> New work categories </a>
<a href="insert.html"><i class="icon-font"></i> New blog category </a>
<a href="#"><i class="icon-font"></i> Work review </a>
</div>
</div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> System basic information </h1>
</div>
<div class="result-content">
<ul class="sys-info-list">
<li>
<label class="res-lab"> operating system </label><span class="res-info">WINNT</span>
</li>
<li>
<label class="res-lab"> Running environment </label><span class="res-info">Apache/2.2.21 (Win64) PHP/5.3.10</span>
</li>
<li>
<label class="res-lab">PHP Operation mode </label><span class="res-info">apache2handler</span>
</li>
<li>
<label class="res-lab"> Design quietly - edition </label><span class="res-info">v-0.1</span>
</li>
<li>
<label class="res-lab"> Upload attachment restrictions </label><span class="res-info">2M</span>
</li>
<li>
<label class="res-lab"> Beijing time. </label><span class="res-info">2014 year 3 month 18 Japan 21:08:24</span>
</li>
<li>
<label class="res-lab"> Server domain name /IP</label><span class="res-info">localhost [ 127.0.0.1 ]</span>
</li>
<li>
<label class="res-lab">Host</label><span class="res-info">127.0.0.1</span>
</li>
</ul>
</div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> Use the help </h1>
</div>
<div class="result-content">
<ul class="sys-info-list">
<li>
<label class="res-lab"> More templates :</label><span class="res-info"><a href="http://www.codejie.net/" target="_blank"> Source street - Free source download </a></span>
</li>
</ul>
</div>
</div>
</div>
<!--/main-->
</div>
</body>
</html>
Create a header template in view Create under directory comm The directory is creating head.html
/home/view/comm/head.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title> Background management </title>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/common.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/main.css"/>
</head>
<body>
<div class="topbar-wrap white">
<div class="topbar-inner clearfix">
<div class="topbar-logo-wrap clearfix">
<h1 class="topbar-logo none"><a href="index.html" class="navbar-brand"> Background management </a></h1>
<ul class="navbar-list clearfix">
<li><a class="on" href="index.html"> home page </a></li>
<li><a href="#" target="_blank"> homepage </a></li>
</ul>
</div>
<div class="top-info-wrap">
<ul class="top-info-list clearfix">
<li><a href="#"> Administrators </a></li>
<li><a href="#"> Change Password </a></li>
<li><a href="#"> sign out </a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="sidebar-wrap">
<div class="sidebar-title">
<h1> menu </h1>
</div>
<div class="sidebar-content">
<ul class="sidebar-list">
<li>
<a href="#"><i class="icon-font"></i> Common operations </a>
<ul class="sub-menu">
<li><a href="design.html"><i class="icon-font"></i> Work management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Blog management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Classification management </a></li>
<li><a href="design.html"><i class="icon-font"></i> message management </a></li>
<li><a href="design.html"><i class="icon-font"></i> Comment management </a></li>
<li><a href="design.html"><i class="icon-font"></i> link </a></li>
<li><a href="design.html"><i class="icon-font"></i> Advertising management </a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-font"></i> System management </a>
<ul class="sub-menu">
<li><a href="system.html"><i class="icon-font"></i> System settings </a></li>
<li><a href="system.html"><i class="icon-font"></i> Clean cache </a></li>
<li><a href="system.html"><i class="icon-font"></i> The data backup </a></li>
<li><a href="system.html"><i class="icon-font"></i> Data restore </a></li>
</ul>
</li>
</ul>
</div>
</div>
stay /home/view/index.html This header template is directly included in
<include file="comm/head" />
<!--/sidebar-->
<div class="main-wrap">
<div class="crumb-wrap">
<div class="crumb-list"><i class="icon-font"></i><span> Welcome to use 『 Passion 』 Blog program , The preferred tool for Jianbo .</span></div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> shortcuts </h1>
</div>
<div class="result-content">
<div class="short-wrap">
<a href="insert.html"><i class="icon-font"></i> New works </a>
<a href="insert.html"><i class="icon-font"></i> The new post </a>
<a href="insert.html"><i class="icon-font"></i> New work categories </a>
<a href="insert.html"><i class="icon-font"></i> New blog category </a>
<a href="#"><i class="icon-font"></i> Work review </a>
</div>
</div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> System basic information </h1>
</div>
<div class="result-content">
<ul class="sys-info-list">
<li>
<label class="res-lab"> operating system </label><span class="res-info">WINNT</span>
</li>
<li>
<label class="res-lab"> Running environment </label><span class="res-info">Apache/2.2.21 (Win64) PHP/5.3.10</span>
</li>
<li>
<label class="res-lab">PHP Operation mode </label><span class="res-info">apache2handler</span>
</li>
<li>
<label class="res-lab"> Design quietly - edition </label><span class="res-info">v-0.1</span>
</li>
<li>
<label class="res-lab"> Upload attachment restrictions </label><span class="res-info">2M</span>
</li>
<li>
<label class="res-lab"> Beijing time. </label><span class="res-info">2014 year 3 month 18 Japan 21:08:24</span>
</li>
<li>
<label class="res-lab"> Server domain name /IP</label><span class="res-info">localhost [ 127.0.0.1 ]</span>
</li>
<li>
<label class="res-lab">Host</label><span class="res-info">127.0.0.1</span>
</li>
</ul>
</div>
</div>
<div class="result-wrap">
<div class="result-title">
<h1> Use the help </h1>
</div>
<div class="result-content">
<ul class="sys-info-list">
<li>
<label class="res-lab"> More templates :</label><span class="res-info"><a href="http://www.codejie.net/" target="_blank"> Source street - Free source download </a></span>
</li>
</ul>
</div>
</div>
</div>
<!--/main-->
</div>
</body>
</html>
/home/view/comm/insert.html
<include file="comm/head" />
<!--/sidebar-->
<div class="main-wrap">
<div class="crumb-wrap">
<div class="crumb-list"><i class="icon-font"></i><a href="/jscss/admin/design/"> home page </a><span class="crumb-step">></span><a class="crumb-name" href="/jscss/admin/design/"> Work management </a><span class="crumb-step">></span><span> New works </span></div>
</div>
<div class="result-wrap">
<div class="result-content">
<form action="/jscss/admin/design/add" method="post" id="myform" name="myform" enctype="multipart/form-data">
<table class="insert-tab" width="100%">
<tbody><tr>
<th width="120"><i class="require-red">*</i> classification :</th>
<td>
<select name="colId" id="catid" class="required">
<option value=""> Please select </option>
<option value="19"> Boutique interface </option><option value="20"> Recommendation interface </option>
</select>
</td>
</tr>
<tr>
<th><i class="require-red">*</i> title :</th>
<td>
<input class="common-text required" id="title" name="title" size="50" value="" type="text">
</td>
</tr>
<tr>
<th> author :</th>
<td><input class="common-text" name="author" size="50" value="admin" type="text"></td>
</tr>
<tr>
<th><i class="require-red">*</i> thumbnail :</th>
<td><input name="smallimg" id="" type="file"><!--<input type="submit" onclick="submitForm('/jscss/admin/design/upload')" value=" To upload pictures "/>--></td>
</tr>
<tr>
<th> Content :</th>
<td><textarea name="content" class="common-textarea" id="content" cols="30" style="width: 98%;" rows="10"></textarea></td>
</tr>
<tr>
<th></th>
<td>
<input class="btn btn-primary btn6 mr10" value=" Submit " type="submit">
<input class="btn btn6" onClick="history.go(-1)" value=" return " type="button">
</td>
</tr>
</tbody></table>
</form>
</div>
</div>
</div>
<!--/main-->
</div>
</body>
</html>
边栏推荐
- 调查显示传统数据安全工具面对勒索软件攻击的失败率高达 60%
- C how TCP restricts the access traffic of a single client
- Jarvis OJ 简单网管协议
- Detailed explanation of printf() and scanf() functions of C language
- 激动人心!2022开放原子全球开源峰会报名火热开启!
- Function sub file writing
- How to write a full score project document | acquisition technology
- Thoughtworks 全球CTO:按需求构建架构,过度工程只会“劳民伤财”
- Embedded-c language-6
- 一个满分的项目文档是如何书写的|得物技术
猜你喜欢
拷贝方式之DMA
Games101 notes (III)
调查显示传统数据安全工具面对勒索软件攻击的失败率高达 60%
Practical example of propeller easydl: automatic scratch recognition of industrial parts
Use JDBC technology and MySQL database management system to realize the function of course management, including adding, modifying, querying and deleting course information.
Etcd build a highly available etcd cluster
Jarvis OJ simple network management protocol
npm安装
Wsl2.0 installation
Solution of vant tabbar blocking content
随机推荐
高数 | 旋转体体积计算方法汇总、二重积分计算旋转体体积
Is it safe for qiniu business school to open a stock account? Is it reliable?
The two ways of domestic chip industry chain go hand in hand. ASML really panicked and increased cooperation on a large scale
时间戳strtotime前一天或后一天的日期
Embedded -arm (bare board development) -2
【testlink】TestLink1.9.18常见问题解决方法
域名解析,反向域名解析nbtstat
【729. 我的日程安排表 I】
什么是ROM
机器学习01:绪论
[Jianzhi offer] 63 Maximum profit of stock
npm安装
微信公众号网页授权登录实现起来如此简单
机器学习编译第2讲:张量程序抽象
[7.7 live broadcast preview] the lecturer of "typical architecture of SaaS cloud native applications" teaches you to easily build cloud native SaaS applications. Once the problem is solved, Huawei's s
IDC报告:腾讯云数据库稳居关系型数据库市场TOP 2!
Embedded-c Language-1
激动人心!2022开放原子全球开源峰会报名火热开启!
SQL injection of cisp-pte (Application of secondary injection)
Jarvis OJ Flag