温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

phpcms 调用多级栏目和多级栏目下的文章列表

发布时间:2020-07-02 10:43:08 来源:网络 阅读:1508 作者:gutaotao1989 栏目:web开发

phpcms 调用多级栏目和多级栏目下的文章列表

实现代码如下:

{loop subcat($catid) $c}
    {if $c['child']}
    {php $child = subcat($c['catid']);}  
    <div class="wj_fenlei">
        <div class="fenlei_pic">
        	<em><img src="{php echo $c['p_w_picpath'];}" width="298" height="144" alt="" /></em>
            <div class="xmtit">{php echo $c['catname'];}+</div>
            <div class="xian">
            	<span>{php echo "<a href='".$c['url']."' target='_blank'>".$c['catname']."</a>";}</span>
                <div class="xm_a">
                	{loop $child $catc}
                		{php $subcatid[] = $catc['catid'];}
                    	{php echo "<a href='".$catc['url']."' target='_blank'>".$catc['catname']."</a>";}
                    {/loop}
                </div>
            </div>
        </div>
        <ul>     
{php $subcatid  = implode(',', $subcatid);}
{php $arr=explode(',',$subcatid);}
{pc:get sql="SELECT * from v9_news where status=99 and catid in ($subcatid) order by id DESC LIMIT 0,4--" num="6" return="data"}
	{loop $data $r}
             <li> <a href="{$r[url]}" target="_blank" title="{$r['title']}">● [{$CATEGORYS[$r[catid]][catname]}] {str_cut($r['title'],40)}</a></li>  
	{/loop}
{/pc}
        </ul>
        <div class="zs_more">
        {php echo "<a href='".$c['url']."' target='_blank'>我想了解更多".$c['catname']."知识</a>";}
        </div>    	
    </div>
    {php $subcatid = null;}
 	{/if}
{/loop}


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI