PbootCMS整理13个常用if条件判断语句总结分享,隔行换色,导航高亮,缩略图判断等
1、导航高亮{pboot:if(''=='{sort:tcode}')}class="active"{/pboot:if}2、判断有无子菜单
{pboot:if(>0)}...{/pboot:if}3、内页子菜单高亮
{pboot:if(''=='{sort:scode}')}class="active"{/pboot:if}4、判断标签为空时不显示
{pboot:if('{pboot:companyqq}'!='')}QQ:{pboot:companyqq}{/pboot:if}5、判断列表页有无内容,无内容返回提示
{pboot:if({page:rows}>0)}{page:bar}{else}暂无内容{/pboot:if}6、分页判断进阶
{pboot:if({page:rows}>0)} <div class="page"> <a href="{page:index}" {pboot:2if('{page:current}'==1)}class="hide"{/pboot:2if}>首页</a> <a href="{page:pre}" {pboot:2if('{page:current}'==1)}class="hide"{/pboot:2if}>上一页</a> {page:numbar} <a href="{page:next}" {pboot:2if('{page:current}'=='{page:count}')}class="hide"{/pboot:2if}>下一页</a> <a href="{page:last}" {pboot:2if('{page:current}'=='{page:count}')}class="hide"{/pboot:2if}>尾页</a> </div> {else} <div class="page">暂无内容</div> {/pboot:if}7、判断第一个循环项,并添加 class
{pboot:if(''=='1')}class="active"{/pboot:if}8、内容页判断有无多图,无多图显示缩略图
{pboot:if({content:ispics}==1)}...多图...{else}...缩略图...{/pboot:if}9、内容页判断列表中的当前文章高亮
{pboot:if(''=='{content:link}')}class="active"{/pboot:if}10、奇偶数判断(隔行变色)
{pboot:if(%2==0)}...{/pboot:if}11、判断导航从第几个开始
{pboot:if(''>2)}...{/pboot:if}12、隐藏指定 scode 的菜单
{pboot:if(==2||==4||==6)}style="display: none;"{/pboot:if}13、pbootcms导航栏logo居中判断
{pboot:if(==3)}<img src="{pboot:sitelogo}">{/pboot:if}
页:
[1]