This article describes how to use the built-in functions of the smarty template engine, such as if, elseif, and else. It uses two examples to analyze the usage skills of if, elseif, and else. For more information, see
This article describes how to use the built-in functions of the smarty template engine, such as if, elseif, and else. It uses two examples to analyze the usage skills of if, elseif, and else. For more information, see
This article describes how to use elp, makewebs, php, 2014042592404.html "> smartyelp, makewebs, asks, 2014042090164.html"> built-in functions if, elseif, and else for your reference. The details are as follows:
Template File: temp. tpl
The Code is as follows:
Use of smarty built-in functions such as if, elseif, and else
Instance 1 --> Use of if: retrieve key values other than c3 and n3.
{Foreach from = $ arr4 item = temp}
{Foreach from = $ temp item = value key = k}
{If $ k neq "c3" and $ k neq "n3 "}
{$ K }={ $ value}
{/If}
{/Foreach}
{/Foreach}
Example 2 --> Use of elseif: if it is a beauty, output a sentence, otherwise output another sentence
{Foreach from = $ arr4 item = temp}
{Foreach from = $ temp item = value key = k}
{If $ value eq ""}
You are a pretty girl
{Else}
You are all handsome guys.
{/If}
{/Foreach}
{/Foreach}
I hope this article will help you with php programming.