The usage of built-in functions such as if, elseif, and else in the smarty template engine is smartyelseif. The usage of the built-in functions if, elseif, and else in the smarty template engine. This document describes how to use the built-in functions if, elseif, and else in smarty, we will share with you how to use the built-in functions if, elseif, and else in the smarty template engine.
This article describes how to use the built-in functions of smarty, such as if, elseif, and else. 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.
Examples in this article describes how to use the built-in functions of smarty, such as if, elseif, and else...