Home > Backend Development > PHP Tutorial > phpcms 这样条件的栏目怎样调用呢

phpcms 这样条件的栏目怎样调用呢

WBOY
Release: 2016-06-23 13:42:35
Original
1050 people have browsed it

条件是:parentid  等于1的所有栏目,我想调出来,不知如何写啊

我这样写:
{pc:content action="category" parentid="1" num="25" siteid="$siteid" order="listorder ASC"}
          {loop $data $r}
          

  • {$r[catname]}

  •           {/loop}
              {/pc}
    调不出来呢


    回复讨论(解决方案)

    	/**	 * 栏目标签	 * @param $data	 */	public function category($data) {		$data['catid'] = intval($data['catid']);		$array = array();		$siteid = $data['siteid'] && intval($data['siteid']) ? intval($data['siteid']) : get_siteid();		$categorys = getcache('category_content_'.$siteid,'commons');		$site = siteinfo($siteid);		$i = 1;		foreach ($categorys as $catid=>$cat) {			if($i>$data['limit']) break;			if((!$cat['ismenu']) || $siteid && $cat['siteid']!=$siteid) continue;			if (strpos($cat['url'], '://') === false) {				$cat['url'] = substr($site['domain'],0,-1).$cat['url'];			}			if($cat['parentid']==$data['catid']) {				$array[$catid] = $cat;				$i++;			}		}		return $array;	}	
    Copy after login

    从该标签实现看,没有parentid参数

    source:php.cn
    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
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template