当前位置:网站首页>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>
边栏推荐
猜你喜欢

Learnopongl notes (I)

Embedded UC (UNIX System Advanced Programming) -1

China Radio and television officially launched 5g services, and China Mobile quickly launched free services to retain users

URP下Alpha从Gamma空间到Linner空间转换(二)——多Alpha贴图叠加

IDC报告:腾讯云数据库稳居关系型数据库市场TOP 2!

Etcd build a highly available etcd cluster

Jarvis OJ simple network management protocol

基于51单片机的电子时钟设计

The second day of learning C language for Asian people

thinkphp模板的使用
随机推荐
国产芯片产业链两条路齐头并进,ASML真慌了而大举加大合作力度
Twig数组合并的写法
C# TCP如何设置心跳数据包,才显得优雅呢?
Games101 notes (II)
Is it safe for qiniu business school to open a stock account? Is it reliable?
Embedded UC (UNIX System Advanced Programming) -2
C how TCP restricts the access traffic of a single client
【testlink】TestLink1.9.18常见问题解决方法
中国广电正式推出5G服务,中国移动赶紧推出免费服务挽留用户
高数 | 旋转体体积计算方法汇总、二重积分计算旋转体体积
Function sub file writing
33:第三章:开发通行证服务:16:使用Redis缓存用户信息;(以减轻数据库的压力)
Wsl2.0 installation
2022 年 Q2 加密市场投融资报告:GameFi 成为投资关键词
C# TCP如何限制单个客户端的访问流量
PHP人才招聘系统开发 源代码 招聘网站源码二次开发
Combined use of vant popup+ other components and pit avoidance Guide
How can C TCP set heartbeat packets to be elegant?
Allusions of King Xuan of Qi Dynasty
easyNmon使用汇总