php无限分类获得当前位置的函数
<?php /* * @name pcb_article_position * @access public * @param int $id * @param string $split * @return string */ function pcb_article_position ($id, $split=" ") { global $mysql, $system_webpath; $array = array(); $string = ''; do { $temp = $mysql->fetch("SELECT `id`, `parent_id`, `name` FROM `pcb_article_category` WHERE `id` = " . $id . " LIMIT 1"); $array[] = $temp; $id = $temp['parent_id']; } while ($temp['parent_id'] != 0); /* * @按二维数组key的降序重新排序 */ krsort($array); foreach ($array as $value) { $string .= $split . "<a href='" . $system_webpath . "/article/list-id-" . $value['id'] . "-page-1.html' title='" . $value['name'] . "'>" . $value['name'] . "</a>"; } return $string; } ?>