{pboot:if('[nav:scode]'=='{sort:tcode}')}class="active"{/pboot:if} //用于非首页
例:
01 02 03 04 | < code >{pboot:nav} < li {pboot:if('[nav:scode]'=='{sort:tcode}')} class = "active" {/pboot:if}>< a href = "[nav:link]" >[nav:name]</ a ></ li > {/pboot:nav} </ code > |
{pboot:if([nav:soncount]>0)}...{/pboot:if}
例 1:
01 02 03 04 05 06 07 08 09 10 11 12 | < code >{pboot:nav} < li >< a href = "[nav:link]" >[nav:name]</ a > <!--一级菜单循环--> {pboot:if([nav:soncount]>0)} <!--当有子菜单时显示div--> < div > {pboot:2nav parent=[nav:scode]} < a href = "[2nav:link]" >[2nav:name]</ a > <!--二级菜单循环--> {/pboot:2nav} </ div > {/pboot:if} </ li > {/pboot:nav} </ code > |
例2:
01 02 03 04 | < code >{pboot:nav} < li >< a {pboot:if([nav:soncount]>0)} href="javascript:;" {else} href="[nav:link]" {/pboot:if}>[nav:name]</ a ></ li > <!--无子菜单时显示正常链接,有子菜单时为空连接,用于手机端点击菜单滑出子菜单情况。--> {/pboot:nav} </ code > |
{pboot:if('[nav:scode]'=='{sort:scode}')}class="active"{/pboot:if}
例:
01 02 03 04 | < code >{pboot:nav parent={sort:tcode}} < li {pboot:if('[nav:scode]'=='{sort:scode}')} class = "active" {/pboot:if}>< a href = "[nav:link]" >[nav:name]</ a ></ li > {/pboot:nav} </ code > |
01 02 | < code >{pboot:if('{pboot:companyqq}'!='')}QQ:{pboot:companyqq}{/pboot:if} <!--同理也可用在文章详情页--> </ code > |
{pboot:if({page:rows}>0)}{page:bar}{else}暂无内容{/pboot:if}
例:
01 02 03 04 05 06 07 08 09 10 11 12 | < code >{pboot:if({page:rows}>0)} < div class = "page" > < a href = "{page:index}" >首页</ a > < a href = "{page:pre}" >上一页</ a > {page:numbar} < a href = "{page:next}" >下一页</ a > < a href = "{page:last}" >尾页</ a > </ div > {else} < div class = "page" >暂无内容</ div > {/pboot:if} </ code > |
例:
01 02 03 04 05 06 07 08 09 10 11 12 | < code >{pboot:if({page:rows}>0)} < div class = "page" > < a href = "{page:index}" {pboot:2if('{page:current}'==1)} class = "hide" {/pboot:2if}>首页</ a > <!--在第一页时,当前页码‘{page:current}’等于1,添加‘hide’样式,.hide{dispaly:none;}--> < 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 > <!--在最后一页时,当前页码‘{page:current}’等于总页数‘{page:count},’添加‘hide’样式,.hide{dispaly:none;}--> < a href = "{page:last}" {pboot:2if('{page:current}'=='{page:count}')} class = "hide" {/pboot:2if}>尾页</ a > <!--与上条同理--> </ div > {else} < div class = "page" >暂无内容</ div > {/pboot:if} </ code > |
{pboot:if('[xx:i]'=='1')}class="active"{/pboot:if}
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 | < code > <!--第一个菜单添加 class="active"--> {pboot:nav} < a href = "[nav:link]" {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--> </ code > |
{pboot:if({content:ispics}==1)}..多图..{else}..缩略图..{/pboot:if}
例:
01 02 03 04 05 06 07 08 09 10 | < code >{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} </ code > |
###9.内容页判断列表中的当前文章高亮(右侧推荐文章中的其中一条,正好是当前打开的文章时)
{pboot:if('[list:link]'=='{content:link}')}class="active"{/pboot:if} //判断列表内链接等于本文链接
例:
01 02 03 04 05 06 | < code >< 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]" >[list:title]</ a ></ li > {/pboot:list} </ ul > </ code > |
{pboot:if([list:i]%2==0)}...{/pboot:if}
例:
01 02 03 04 05 06 | < code >< ul > {pboot:list num=10} < li {pboot:if([list:i]%2==0)} class = "bg-dark" {/pboot:if}>< a href = "[list:link]" >[list:title]</ a ></ li > <!--等于0为偶数,等于1为奇数 .bg-dark{background:#000;}--> {/pboot:list} </ ul > </ code > |
{pboot:if('[nav:i]'>'2')}……{/pboot:if} //从第二个开始
例:
01 02 03 04 05 06 | < code >{pboot:nav} {pboot:if('[nav:i]'>'2')} < li >< a href = "[nav:link]" >[nav:name]</ a ></ li > {/pboot:if} {/pboot:nav} </ code > |
{pboot:if([nav:scode]==2||[nav:scode]==4||[nav:scode]==6)}style="display: none;"{/pboot:if} //隐藏 scode 为 2,4,6 的菜单id
例:
01 02 03 04 | < code >{pboot:nav} < li {pboot:if([nav:scode]==2||[nav:scode]==4||[nav:scode]==6)} style = "display: none;" {/pboot:if}>< a href = "[nav:link]" >[nav:name]</ a ></ li > {/pboot:nav} </ code > |
例:
01 02 03 04 05 06 07 | < code >{pboot:nav} < a href = "[nav:link]" >[nav:name]</ a > {pboot:if([nav:i]==3)} < img src = "{pboot:sitelogo}" > {/pboot:if} {/pboot:nav} </ code > |
上面的的[nav:i]=3意思就是当输出到第三个导航栏的时候,在输出logo样式