当前位置:网站首页>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>
边栏推荐
- PHP人才招聘系统开发 源代码 招聘网站源码二次开发
- Cs231n notes (bottom) - applicable to 0 Foundation
- 麻烦问下,DMS中使用Redis语法是以云数据库Redis社区版的命令为参考的嘛
- [61dctf]fm
- Games101 notes (II)
- Etcd 构建高可用Etcd集群
- 2022 年 Q2 加密市场投融资报告:GameFi 成为投资关键词
- thinkphp模板的使用
- [Jianzhi offer] 62 The last remaining number in the circle
- Judge whether a string is a full letter sentence
猜你喜欢

thinkphp3.2.3

干货!半监督预训练对话模型 SPACE

激动人心!2022开放原子全球开源峰会报名火热开启!

【729. 我的日程安排錶 I】

Read the basic grammar of C language in one article

thinkphp模板的使用

The first EMQ in China joined Amazon cloud technology's "startup acceleration - global partner network program"

Error in composer installation: no composer lock file present.

Games101 notes (I)

浏览器渲染原理以及重排与重绘
随机推荐
Games101 notes (I)
PHP talent recruitment system development source code recruitment website source code secondary development
Application of threshold homomorphic encryption in privacy Computing: Interpretation
npm安装
Embedded-c Language-5
Browser rendering principle and rearrangement and redrawing
[729. My Schedule i]
调查显示传统数据安全工具面对勒索软件攻击的失败率高达 60%
【机器人坐标系第一讲】
[first lecture on robot coordinate system]
Wechat official account web page authorization login is so simple
winedt常用快捷键 修改快捷键latex编译按钮
【Web攻防】WAF检测技术图谱
域名解析,反向域名解析nbtstat
张平安:加快云上数字创新,共建产业智慧生态
外盘期货平台如何辨别正规安全?
dried food! Semi supervised pre training dialogue model space
Use byte stream to read Chinese from file to console display
It is forbidden to copy content JS code on the website page
【性能测试】全链路压测