15621857753

PHPCMSV9首页循环调用指定栏目的子栏目的方法

来源:齐鲁建站 栏目:开发教程 阅读: 日期:2020-08-11

最近有朋友使用PHPCMS建站,想要了解PHPCMSV9首页循环调用指定栏目的子栏目的方法,下面我们通过一案例详细说明。

下面就来说说phpcms首页循环调用的方法。

代码如下:

{php $j=1;}

{loop subcat(108) $v}

{php if($v['type']!=0) continue;}

<div class="Our-services left marginbottom20 hidden">

<h2><a href="{$v[url]}" title="{$v[catname]}">{$v[catname]}</a></h2>

<div class="clear hidden">

<ul>

<div class="marginbottom10 hidden">

<span class="left"><a href="{$v[url]}" title="{$v[catname]}"><img src="{$CATEGORYS[$v[catid]][image]}" title="{$v[catname]}" alt="{$v[catname]}" width="70" height="60" /></a></span>

<span class="right">

{pc:get sql="SELECT `title`,`url`,`description` FROM `v9_news` where `posids`<>0 AND `catid`=$v[catid] ORDER BY `inputtime` DESC" num="1" return="data"}

{loop $data $r}

<a href="{$r[url]}" title="{$r[title]}" target="_blank">{str_cut(strip_tags($r[description]),100,"...")}</a>

{/loop}

{/pc}

</span>

</div>

{pc:content action="lists" catid="$v[catid]" num="7" start="2" order="inputtime DESC"}

{loop $data $r}

<li class="height30 hidden"><span class="right f12 cdgrey">{date('m-d',$r[inputtime])}</span><a href="{$r[url]}" title="{$r[title]}"{title_style($r[style])}target="_blank">{$r[title]}</a></li>

{/loop}

{/pc}

</ul>

</div>

</div>

{$j++}

{/loop} 

代码说明:

subcat(108)中的108为指定栏目的ID 

{$CATEGORYS[$v[catid]][image]}这个为调用栏目图片,编辑栏目可以上传 

where `posids`<>0这个是限制只调用推荐文章 

{str_cut(strip_tags($r[description]),100,"...")} 这个是截至100字数并过滤html代码。

展开