主机参考:VPS测评参考推荐/专注分享VPS服务器优惠信息!若您是商家可以在本站进行投稿,查看详情!此外我们还提供软文收录、PayPal代付、广告赞助等服务,查看详情! |
我们发布的部分优惠活动文章可能存在时效性,购买时建议在本站搜索商家名称可查看相关文章充分了解该商家!若非中文页面可使用Edge浏览器同步翻译!PayPal代付/收录合作 |
如何在phpcms主页上只显示指定的列?
以下代码控制按列id显示哪些列。id根据实际情况在后台查询,subcat函数查看最终的附件说明。按如下方式修改代码:
{ loop subcat(0,0,$ siteid)$ r } { if $ r【& amp;#39;catid & amp#39;】= = 1 | | $ r【& amp;#39;catid & amp#39;】==2} //显示哪些列{ PHP $ num++ }《div class = & quot;箱猫区& quot{if $num%2!= 0 } style = & quot右边距:10px & quot{/if } & gt;& lth5 class = & quot标题1 & quot& gt{ $ r } & lta href = & quot{ $ r } & quotclass = & quot更多"& gt更多》》;& lt/a & gt;& lt/H5 & gt;& ltdiv class = & quot内容& quot& gt{ PC:content action = & quot;列表& quotcatid = & quot$ r & quotorder = & quot更新时间desc & quot;拇指= & quot1 & quotnum = & quot1 & quotreturn = & quot信息& quot} { loop $ info $ v } & ltp & gt& ltimg src = & quot{ thumb $ v,90,0 } & quot;宽度= & quot90 & quotstyle = & quot最大宽度:90%"/& gt;& ltstrong & gt& lt目标= & quot_ blank & quottitle = & quot{ $ v【& amp;#39;标题和标题。#39;】} & quot{ title _ style(v)} & gt;{ str _ cut(v【& amp;#39;标题和标题。#39;】,28)} & lt;/a & gt;& lt/strong & gt;& ltbr/>;{ str _ cut(v【& amp;#39;描述&。#39;】,100)} & lt;/p & gt;{/loop } {/PC } & lt;div class = & quotbk15 hr & quot& gt& lt/div & gt;{ PC:content action = & quot;列表& quotcatid = & quot$ r & quotnum = & quot5 & quotorder = & quotid DESCreturn = & quot信息& quot} & ltul class = & quot列出lh24 f14 & quot& gt{ loop $ info $ v } & lt李& gt& lta href = & quot{ $ v【& amp;#39;url & amp#39;】} & quottarget = & quot_ blank & quottitle = & quot{ $ v【& amp;#39;标题和标题。#39;】} & quot{ title _ style(v)} & gt;{ str _ cut(v【& amp;#39;标题和标题。#39;】,40)} & lt;/a & gt;& lt/李& gt{/loop } & lt;/ul & gt;{/PC } & lt;/div & gt;& lt/div & gt;{ if $ num % 2 = = 0 } & ltdiv class = & quotbk10 & quot& gt& lt/div & gt;{/if} {/if} {/loop}除了指定特定的列之外,我们还可以通过排除特定的列来显示它们。
排除列的方法
{ loop subcat(0,0,$ siteid)$ r } { if $ r【& amp;#39;catid & amp#39;】= = 3 } & lt?php继续;?& gt{/if} //排除列{ PHP $ num++ }《div class = & quot;箱猫区& quot{if $num%2!= 0 } style = & quot右边距:10px & quot{/if } & gt;& lth5 class = & quot标题1 & quot& gt{ $ r } & lta href = & quot{ $ r } & quotclass = & quot更多"& gt更多》》;& lt/a & gt;& lt/H5 & gt;& ltdiv class = & quot内容& quot& gt{ PC:content action = & quot;列表& quotcatid = & quot$ r & quotorder = & quot更新时间desc & quot;拇指= & quot1 & quotnum = & quot1 & quotreturn = & quot信息& quot} { loop $ info $ v } & ltp & gt& ltimg src = & quot{ thumb $ v,90,0 } & quot;宽度= & quot90 & quotstyle = & quot最大宽度:90%"/& gt;& ltstrong & gt& lt目标= & quot_ blank & quottitle = & quot{ $ v【& amp;#39;标题和标题。#39;】} & quot{ title _ style(v)} & gt;{ str _ cut(v【& amp;#39;标题和标题。#39;】,28)} & lt;/a & gt;& lt/strong & gt;& ltbr/>;{ str _ cut(v【& amp;#39;描述&。#39;】,100)} & lt;/p & gt;{/loop } {/PC } & lt;div class = & quotbk15 hr & quot& gt& lt/div & gt;{ PC:content action = & quot;列表& quotcatid = & quot$ r & quotnum = & quot5 & quotorder = & quotid DESCreturn = & quot信息& quot} & ltul class = & quot列出lh24 f14 & quot& gt{ loop $ info $ v } & lt李& gt& lta href = & quot{ $ v【& amp;#39;url & amp#39;】} & quottarget = & quot_ blank & quottitle = & quot{ $ v【& amp;#39;标题和标题。#39;】} & quot{ title _ style(v)} & gt;{ str _ cut(v【& amp;#39;标题和标题。#39;】,40)} & lt;/a & gt;& lt/李& gt{/loop } & lt;/ul & gt;{/PC } & lt;/div & gt;& lt/div & gt;{ if $ num % 2 = = 0 } & ltdiv class = & quotbk10 & quot& gt& lt/div & gt;{/if } {/loop } { loop subcat(0,0,$ siteid)$ r } {/loop }函数解释:
/* * *获取子列* @param $parentid父id * @param $type列类型1是单页类型,0是列类型;(可以从phpcms的mysql数据库中看到)* @param $self是否包含站点ID */function subcat($ parentid = null,$ type = null,$ self = &;#39;0 & amp#39;,$ siteid = & amp#39;& amp#39;){ if(empty($ siteid))$ siteid = get _ siteid();$ category = get cache(& amp;#39;类别内容。#39;。$ siteid & amp;#39;康芒斯公司。#39;);foreach($ category as $ id = & gt;$ cat){ if($ cat【& amp;#39;siteid & amp#39;】= = $ siteid & amp& amp($ parentid = = = NULL | | $ cat【& amp;#39;parentid & amp#39;】= = $ parentid)& amp;& amp($ type = = = NULL | | $ cat【& amp;#39;类型&。#39;】= = $ type))$ subcat【$ id】= $ cat;if($ self = = 1 & amp;& amp$ cat【& amp;#39;catid & amp#39;】= = $ parentid & amp& amp!$ cat【& amp;#39;儿童和青少年。#39;】)$ subcat【$ id】= $ cat;} return $ subcat}PHP中文网站,很多免费的PHPCMS教程,欢迎在线学习!
这几篇文章你可能也喜欢:
- PHPCMS漏洞文件poster.php(php readfile漏洞)
- phpcms有什么用(如何使用phpcms)
- phpcms如何登录后台?
- 如何将phpcms连接到数据库(phpcms使用教程)
- 如何向phpcms添加列(php添加页面)
本文由主机参考刊发,转载请注明:如何在phpcms主页上仅显示指定的列(phpstudy主页设置) https://zhujicankao.com/111382.html
评论前必须登录!
注册