Home  >  Article  >  php教程  >  phpcms 导航 当前位置

phpcms 导航 当前位置

PHP中文网
PHP中文网Original
2016-05-25 17:11:341825browse

代码

$CATEGORY = array(
		'1'=>array('catid'=>'1','catname'=>'新闻中心','arrparentid'=>'0'),
		'2'=>array('catid'=>'2','catname'=>'世界新闻','arrparentid'=>'0,1'),
		'3'=>array('catid'=>'3','catname'=>'国内新闻','arrparentid'=>'0,1'),
);
function catpos($catid, $urlrule = '')
{
	global $CATEGORY;


	if(!isset($CATEGORY[$catid])) return '';
	$pos = '';
	$arrparentid = array_filter(explode(',', $CATEGORY[$catid]['arrparentid'].','.$catid));
	foreach($arrparentid as $catid)
	{
		if($urlrule) eval("\$url = \"$urlrule\";");
		else $url = $CATEGORY[$catid]['url'];
		$pos .= &#39;<a href="&#39;.$url.&#39;">&#39;.$CATEGORY[$catid][&#39;catname&#39;].&#39;</a>&#39;;
	}
	return $pos;
}
echo catpos(3);
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