当前位置:网站首页>PHP notes - use Smarty to set public pages (include, if, else, variable settings)
PHP notes - use Smarty to set public pages (include, if, else, variable settings)
2022-07-02 02:34:00 【IT1995】
The main effects are as follows , The login page :
The top is the public page . After logging in users, it's like this .
After successful login , Which homepage is at the top 、 fund 、 gold 、 The stocks are all coming out . And you can click different tabs active, as follows :
fund :
gold :
Stocks :
The realization is like this , Extract the public page :
as follows header.html
<header class="mb-auto">
<div>
<h3 class="float-md-start mb-0"> Financial simulation system <span class="badge bg-light text-dark">Beta V1.0.0</span></h3>
{if $login}
<nav class="nav nav-masthead justify-content-center float-md-end">
<a href="index.php?p=user&c=dashboard&a=index" {if $activeItem == 1} class="nav-link active" {else} class="nav-link" {/if}> home page </a>
<a href="index.php?p=user&c=fund&a=index" {if $activeItem == 2} class="nav-link active" {else} class="nav-link" {/if}> fund </a>
<a href="index.php?p=user&c=gold&a=index" {if $activeItem == 3} class="nav-link active" {else} class="nav-link" {/if}> gold </a>
<a href="index.php?p=user&c=stock&a=index" {if $activeItem == 4} class="nav-link active" {else} class="nav-link" {/if}> Stocks </a>
</nav>
{/if}
</div>
</header>
there login It's a variable , When quoted login by true be , Show the options in the background .
$activeItem It's also a variable , His value is 1,2,3,4, Respectively means the home page 、 fund 、 gold 、 Stocks .
It contains :
The login page contains :
{include file="public/header.html" login=false}
The background page contains :
{include file="public/header.html" activeItem=1 login=true}
What to pay attention to :
①include Variables can be passed in ;
②{if} To be used after completion {/if} Otherwise, the script language cannot judge where it ends .
边栏推荐
- Calculation (computer) code of suffix expression
- The wave of layoffs in big factories continues, but I, who was born in both non undergraduate schools, turned against the wind and entered Alibaba
- [road of system analyst] collection of wrong topics in enterprise informatization chapter
- Summary of some experiences in the process of R & D platform splitting
- 【做题打卡】集成每日5题分享(第二期)
- JS slow animation
- es面試題
- Ten minutes will take you in-depth understanding of multithreading - multithreaded teamwork: synchronous control
- [learn C and fly] day 5 chapter 2 program in C language (Exercise 2)
- trading
猜你喜欢
LeetCode刷题(十)——顺序刷题46至50
Infix expression to suffix expression (computer) code
STM32__ 05 - PWM controlled DC motor
Cesium dynamic diffusion point effect
How to batch add background and transition effects to videos?
【毕业季】研究生学长分享怎样让本科更有意义
Multi threaded query, double efficiency
Additional: information desensitization;
结婚后
AR增强现实可应用的场景
随机推荐
how to come in an investnent bank team
Architecture evolution from MVC to DDD
C return multiple values getter setter queries the database and adds the list return value to the window
SAP ui5 beginner tutorial 19 - SAP ui5 data types and complex data binding
How to run oddish successfully from 0?
Coordinatorlayout + tablayout + viewpager2 (there is another recyclerview nested inside), and the sliding conflict of recyclerview is solved
CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes
結婚後
The basic steps of using information theory to deal with scientific problems are
An analysis of circuit for quick understanding
Multi threaded query, double efficiency
After marriage
【OpenCV】-5种图像滤波的综合示例
CSDN article underlined, font color changed, picture centered, 1 second to understand
Basic 01: print string
结婚后
Webgpu (I): basic concepts
[road of system analyst] collection of wrong topics in enterprise informatization chapter
How to use redis ordered collection
C # use system data. The split mixed mode assembly is generated for the "v2.0.50727" version of the runtime, and it cannot be loaded in the 4.0 runtime without configuring other information