①.导航高亮
{pboot:if('[nav:scode]'=='{sort:tcode}')}class="active"{/pboot:if} //用于非首页
例:
{pboot:nav} <li {pboot:if('[nav:scode]'=='{sort:tcode}')}class="active"{/pboot:if}><a href="[nav:link]" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >[nav:name]</a></li> {/pboot:nav} {pboot:if(0=='{sort:scode}')}class="active"{/pboot:if} //用于首页
例:
<li {pboot:if(0=='{sort:scode}')}class="active"{/pboot:if}><a href="/" rel="external nofollow" >首页</a></li>
②. 判断有无子菜单
{pboot:if([nav:soncount]>0)}...{/pboot:if}
例 1:
{pboot:nav} <li><a href="[nav:link]" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >[nav:name]</a> <!--一级菜单循环-->{pboot:if([nav:soncount]>0)} <!--当有子菜单时显示div--><div>{pboot:2nav parent=[nav:scode]}<a href="[2nav:link]" rel="external nofollow" >[2nav:name]</a> <!--二级菜单循环-->{/pboot:2nav}</div>{/pboot:if}</li>{/pboot:nav}
例 2:
{pboot:nav} <li><a {pboot:if([nav:soncount]>0)} href="javascript:;" rel="external nofollow" {else} href="[nav:link]" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" {/pboot:if}>[nav:name]</a></li> <!--无子菜单时显示正常链接,有子菜单时为空连接,用于手机端点击菜单滑出子菜单情况。-->{/pboot:nav}
③. 内页子菜单高亮
{pboot:if('[nav:scode]'=='{sort:scode}')}class="active"{/pboot:if}
例:
{pboot:nav parent={sort:tcode}} <li {pboot:if('[nav:scode]'=='{sort:scode}')}class="active"{/pboot:if}><a href="[nav:link]" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >[nav:name]</a></li> {/pboot:nav}
4. 判断标签为空时不显示
{pboot:if('{pboot:companyqq}'!='')}QQ:{pboot:companyqq}{/pboot:if} <!--同理也可用在文章详情页-->
5. 判断列表页有无内容,无内容返回提示
{pboot:if({page:rows}>0)}{page:bar}{else}暂无内容{/pboot:if}
例:
{pboot:if({page:rows}>0)}<div class="page"> <a href="{page:index}" rel="external nofollow" rel="external nofollow" >首页</a><a href="{page:pre}" rel="external nofollow" rel="external nofollow" >上一页</a>{page:numbar}<a href="{page:next}" rel="external nofollow" rel="external nofollow" >下一页</a><a href="{page:last}" rel="external nofollow" rel="external nofollow" >尾页</a></div>{else}<div class="page">暂无内容</div>{/pboot:if}
⑥. 分页判断进阶,在第一页时隐藏首页和上一页按钮,在最后一页时隐藏下一页和尾页按钮。
{pboot:if({page:rows}>0)}<div class="page"><a href="{page:index}" rel="external nofollow" rel="external nofollow" {pboot:2if('{page:current}'==1)}class="hide"{/pboot:2if}>首页</a> <!--在第一页时,当前页码‘{page:current}’等于1,添加‘hide’样式,.hide{dispaly:none;}--><a href="{page:pre}" rel="external nofollow" rel="external nofollow" {pboot:2if('{page:current}'==1)}class="hide"{/pboot:2if}>上一页</a> <!--与上条同理-->{page:numbar}<a href="{page:next}" rel="external nofollow" rel="external nofollow" {pboot:2if('{page:current}'=='{page:count}')}class="hide"{/pboot:2if}>下一页</a> <!--在最后一页时,当前页码‘{page:current}’等于总页数‘{page:count},’添加‘hide’样式,.hide{dispaly:none;}--><a href="{page:last}" rel="external nofollow" rel="external nofollow" {pboot:2if('{page:current}'=='{page:count}')}class="hide"{/pboot:2if}>尾页</a><!--与上条同理--></div>{else}<div class="page">暂无内容</div>{/pboot:if}
7.判断第一个循环项,并添加 class(常用于 banner 和 Tab 选项卡)
{pboot:if('[xx:i]'=='1')}class="active"{/pboot:if}
例:
<!--第一个菜单添加 class="active"-->{pboot:nav}<a href="[nav:link]" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" {pboot:if('[nav:i]'=='1')}class="active"{/pboot:if}>[nav:name]</a>{/pboot:nav}<!--第一条文章添加 class="active"-->{pboot:list}<a href= "[list:link]" {pboot:if('[list:i]'=='1')}class="active"{/pboot:if}>[list:title]</a>{/pboot:list}<!--第一个轮播图添加 class="active"-->{pboot:slide gid=* num=*}<img src="[slide:src]" {pboot:if('[slide:i]'=='1')}class="active"{/pboot:if}>{/pboot:slide}<!--以上具体 [xx:i] 用法请参考官方手册,也可以用 jq 的选择器 + addclass-->
⑧.内容页判断有无多图,无多图显示缩略图
{pboot:if({content:ispics}==1)}..多图..{else}..缩略图..{/pboot:if}
例:
{pboot:if({content:ispics}==1)}<ul>{pboot:pics id={content:id} num=5}<li><img src="[pics:src]" /></li> <!--多图循环-->{/pboot:pics}</ul>{else}<img src="{content:ico}" /> <!--缩略图-->{/pboot:if}
⑨.内容页判断列表中的当前文章高亮(右侧推荐文章中的其中一条,正好是当前打开的文章时)
{pboot:if('[list:link]'=='{content:link}')}class="active"{/pboot:if} //判断列表内链接等于本文链接
例:
<ul> {pboot:list scode={sort:tcode} num=10 order='visits'} <li {pboot:if('[list:link]'=='{content:link}')}class="active"{/pboot:if}><a href="[list:link]" rel="external nofollow" rel="external nofollow" >[list:title]</a></li> {/pboot:list} </ul>
⑩.奇偶数判断(隔行变色)
{pboot:if([list:i]%2==0)}...{/pboot:if}
例:
<ul>{pboot:list num=10}<li {pboot:if([list:i]%2==0)}class="bg-dark"{/pboot:if}><a href="[list:link]" rel="external nofollow" rel="external nofollow" >[list:title]</a></li> <!--等于0为偶数,等于1为奇数 .bg-dark{background:#000;}-->{/pboot:list}</ul>
11.判断导航从第几个开始
{pboot:if('[nav:i]'>'2')}……{/pboot:if} //从第二个开始
例:
{pboot:nav} {pboot:if('[nav:i]'>'2')} <li><a href="[nav:link]" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >[nav:name]</a></li> {/pboot:if} {/pboot:nav}
12.隐藏指定 scode 的菜单
{pboot:if([nav:scode]==2||[nav:scode]==4||[nav:scode]==6)}style="display: none;"{/pboot:if} //隐藏 scode 为 2,4,6 的菜单
例:
{pboot:nav} <li {pboot:if([nav:scode]==2||[nav:scode]==4||[nav:scode]==6)}style="display: none;"{/pboot:if}><a href="[nav:link]" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >[nav:name]</a></li> {/pboot:nav}
持续更新…
公告 : 本站提供的源码、模板、插件等等其他资源,不包含技术服务请大家谅解。赞助本站VIP会员免费提供技术服务以及远程协助。
说明: 本站源码压缩包如果有密码,统一解压密码:www.youmuban.com
须知:本站部分资源来源于网络收集,如有侵权,请联系站长进行删除处理。分享目的仅供大家学习和交流,请不要用于商业用途,否则后果自负。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
说明: 本站源码压缩包如果有密码,统一解压密码:www.youmuban.com
须知:本站部分资源来源于网络收集,如有侵权,请联系站长进行删除处理。分享目的仅供大家学习和交流,请不要用于商业用途,否则后果自负。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。