I really dig the idea of using a recursice function to build my site menus but I am having a problem and have been banging my head for ages now. I need my menu function to return a nested list but I dont want non-active irelevent elements of the tree to be displayed.
详情。 我有一个MySql数据库,有一个表格,称为菜单,用于储存所有通常领域的所有物品(目标、链接、文字、所有权等),以及每个项目的独一无二的影子,而重要的是是亲子。
这完全需要辩论,例如,在XML档案中储存这些信息会比较容易?
例如,这里就是一个例子,所有要素都显示:
<ul>
<li><a href="1.html">link 1</a>
<ul>
<li><a href="1-1.html">link 1-1</a>
<li><a href="1-2.html">link 1-2</a>
</ul>
</li>
<li><a href="2.html">link 2</a>
<ul>
<li><a href="2-1.html">link 2-1</a>
<li><a href="2-2.html">link 2-2</a>
</ul>
</li>
<li><a href="3.html">link 3</a></li>
</ul>
但是,如果现在的网页是1-2.html,那么我就希望这样作:
<ul>
<li><a href="1.html">link 1</a>
<ul>
<li><a href="1-1.html">link 1-1</a>
<li><a href="1-2.html">link 1-2</a>
</ul>
</li>
<li><a href="2.html">link 2</a></li>
<li><a href="3.html">link 3</a></li>
</ul>
显然,我将把身份证或现有网页的名称传给Mendu公司。
Any ideas anyone? I have been banging my head against a wall for some time now :-)