当前位置:Gxlcms > PHP教程 > phpcms这样条件的栏目怎样调用呢

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

时间:2021-07-01 10:21:17 帮助过:31人阅读

条件是: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;	}	

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

    人气教程排行