Table of Contents
phpcms_v9如何在首页显示或排除某些栏目subcat(0,0,0,$siteid)
http://blog.csdn.net/a1079540945/article/details/{$r}更多>>
Home php教程 php手册 phpcms_v9如何在首页显示或排除某些栏目subcat(0,0,0,$siteid)

phpcms_v9如何在首页显示或排除某些栏目subcat(0,0,0,$siteid)

Jun 13, 2016 am 09:25 AM
Column

phpcms_v9如何在首页显示或排除某些栏目subcat(0,0,0,$siteid)

v9如何在首页显示或排除某些栏目subcat(0,0,0,$siteid)


通过以下红色部分的栏目id来控制显示哪些栏目,id根据实际情况后台查询,subcat函数看最后附件解释,以下修改代码:

V9显示哪些栏目的方法

{loop subcat(0,0,0,$siteid) $r}
{if $r['catid']==1||$r['catid']==2 } //显示哪些栏目
{php $num++}


http://blog.csdn.net/a1079540945/article/details/{$r}更多>>


{pc:content action="lists" catid="$r" order="updatetime DESC" thumb="1" num="1" return="info"}
{loop $info $v}



target="_blank" title="{$v["title']}"{title_style($v)}>{str_cut($v['title'],28)}
{str_cut($v['description'],100)}


{/loop}
{/pc}


{pc:content action="lists" catid="$r" num="5" order="id DESC" return="info"}

    {loop $info $v}
  • ·{str_cut($v['title'],40)}

  • {/loop}

{/pc}



{if $num%2==0}

{/if}
{/if}
{/loop}


V9排除某个栏目的方法


{loop subcat(0,0,0,$siteid) $r}
{if $r['catid']==3 }{/if} //排除某个栏目
{php $num++}


http://blog.csdn.net/a1079540945/article/details/{$r}更多>>


{pc:content action="lists" catid="$r" order="updatetime DESC" thumb="1" num="1" return="info"}
{loop $info $v}



target="_blank" title="{$v["title']}"{title_style($v)}>{str_cut($v['title'],28)}
{str_cut($v['description'],100)}


{/loop}
{/pc}


{pc:content action="lists" catid="$r" num="5" order="id DESC" return="info"}

    {loop $info $v}
  • ·{str_cut($v['title'],40)}

  • {/loop}

{/pc}



{if $num%2==0}

{/if}
{/loop}

=====================================================

{loop subcat(0,0,0,$siteid) $r}{/loop}函数解释:


{loop subcat(0,0,0,$siteid) $r}{/loop}

/**

* 获取子栏目
* @param $parentid 父级id
* @param $type 栏目类型 1为单网页类型,0为栏目类型;(查看phpcms的mysql数据库可以看到)
* @param $self 是否包含本身 0为不包含
* @param $siteid 站点id
*/
function subcat($parentid = NULL, $type = NULL,$self = '0', $siteid = '') {
if (empty($siteid)) $siteid = get_siteid();
$category = getcache('category_content_'.$siteid,'commons');
foreach($category as $id=>$cat) {
if($cat['siteid'] == $siteid && ($parentid === NULL || $cat['parentid'] == $parentid) && ($type === NULL || $cat['type'] == $type)) $subcat[$id] = $cat;
if($self == 1 && $cat['catid'] == $parentid && !$cat['child']) $subcat[$id] = $cat;
}
return $subcat;
}

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)