How to use the built-in functions if, elseif and else in smarty template engine, smartyelseif
The examples in this article describe the use of smarty’s built-in functions if, elseif and else, and share them with you for your reference. The details are as follows:
Template file: temp.tpl
Copy code The code is as follows:
Usage of smarty built-in functions if, elseif and else
Example 1——>Use of if: Remove key values whose key names are not equal to 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——>Usage of elseif: If it is a beautiful woman, output one sentence, otherwise output another sentence
{foreach from=$arr4 item=temp}
{foreach from=$temp item=value key=k}
{if $value eq "Beauty"}
You are a beauty
{else}
You are all handsome guys
{/if}
{/foreach}
{/foreach}
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/946749.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/946749.htmlTechArticleHow to use the built-in functions if, elseif and else in smarty template engine, smartyelseif This article describes the smarty built-in function in an example The usage of functions if, elseif and else is shared with everyone for your reference...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn