当前位置:网站首页>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 .
边栏推荐
- Deployment practice and problem solving of dash application development environment based on jupyter Lab
- 2022 low voltage electrician test question simulation test question bank simulation test platform operation
- STM32__05—PWM控制直流电机
- After marriage
- Additional: information desensitization;
- [learn C and fly] 1day Chapter 2 (exercise 2.2 find the temperature of Fahrenheit corresponding to 100 ° f)
- LFM信号加噪、时频分析、滤波
- Duplicate keys detected: ‘0‘. This may cause an update error. found in
- Sword finger offer 47 Maximum value of gifts
- Set status bar color
猜你喜欢

Pytest testing framework

How to batch add background and transition effects to videos?

MVVM and MVC

Pychart creates new projects & loads faster & fonts larger & changes appearance

大厂裁员潮不断,双非本科出身的我却逆风翻盘挺进阿里

Pat a-1165 block reversing (25 points)

附加:信息脱敏;

A quick understanding of digital electricity
![[liuyubobobo play with leetcode algorithm interview] [00] Course Overview](/img/1c/c8cab92c74b6658c3ef608c5255f1f.png)
[liuyubobobo play with leetcode algorithm interview] [00] Course Overview

LFM信号加噪、时频分析、滤波
随机推荐
es面試題
Decipher the AI black technology behind sports: figure skating action recognition, multi-mode video classification and wonderful clip editing
An analysis of circuit for quick understanding
WebGPU(一):基本概念
Realize the code scanning function of a custom layout
CoordinatorLayout + TabLayout + ViewPager2(里面再嵌套一个RecyclerView),RecyclerView的滑动冲突解决
LeetCode刷题(十)——顺序刷题46至50
Deployment practice and problem solving of dash application development environment based on jupyter Lab
Systemserver service and servicemanager service analysis
多线程查询,效率翻倍
Formatting logic of SAP ui5 currency amount display
Divorce for 3 years to discover the undivided joint property, or
Webgpu (I): basic concepts
JPM 2021 most popular paper released (with download)
JVM interview
Build a modern data architecture on the cloud with Amazon AppFlow, Amazon lake formation and Amazon redshift
Websocket + spingboot realize code scanning login
Basic 01: print string
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
essay structure