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

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

WBOY
WBOYOriginal
2016-06-13 12:12:53827browse

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

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

  • {$r[catname]}

  •           {/loop}
              {/pc}
    调不出来呢
    ------解决思路----------------------
    <br />	/**<br />	 * 栏目标签<br />	 * @param $data<br />	 */<br />	public function category($data) {<br />		$data['catid'] = intval($data['catid']);<br />		$array = array();<br />		$siteid = $data['siteid'] && intval($data['siteid']) ? intval($data['siteid']) : get_siteid();<br />		$categorys = getcache('category_content_'.$siteid,'commons');<br />		$site = siteinfo($siteid);<br />		$i = 1;<br />		foreach ($categorys as $catid=>$cat) {<br />			if($i>$data['limit']) break;<br />			if((!$cat['ismenu']) <br><font color='#FF8000'>------解决思路----------------------</font><br> $siteid && $cat['siteid']!=$siteid) continue;<br />			if (strpos($cat['url'], '://') === false) {<br />				$cat['url'] = substr($site['domain'],0,-1).$cat['url'];<br />			}<br />			if($cat['parentid']==$data['catid']) {<br />				$array[$catid] = $cat;<br />				$i++;<br />			}<br />		}<br />		return $array;<br />	}<br />	<br />

    从该标签实现看,没有parentid参数
    Statement:
    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