Home > Backend Development > PHP Tutorial > 面包屑导航问题。求救

面包屑导航问题。求救

WBOY
Release: 2016-06-23 13:53:20
Original
1004 people have browsed it


例如,发表一篇文章,该文章属于b分类。将自动往数据库中插入一条信息。 


 当我查看我的文章的时候,请问我要如何让页面显示出面包屑导航。如下一样,我是超新手,很多咚咚都不太明白,请指点。。

首页>> A分类>> b分类  


回复讨论(解决方案)

/*select catid, upid, catname from 分类表执行比读取的数组 $a。是这样的一个数组*/$a = array(  array('catid' => 1, 'upid' => 0, 'catname' => 'A分类'),  array('catid' => 2, 'upid' => 1, 'catname' => 'b分类'),);$a = find_parent($a, 'catid', 'upid');$res = array();$p =& $a[2]; //当前文章的所属分类while($p) {  array_unshift($res, $p['catname']);  if(! isset($p['parent'])) break;  $p =& $p['parent'][$p['upid']];}echo join(' >> ', $res);
Copy after login

函数 find_parent 见  http://bbs.csdn.net/topics/370094009

Related labels:
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