Help with PHP recursive navigation list menu

前端 未结 2 1376
失恋的感觉
失恋的感觉 2020-12-17 05:34

I am trying to add a dynamic recursive navigation list menu to a site of am working on. The scenerio is that the menu has 2 levels related by a parentid(preid).

My i

2条回答
  •  猫巷女王i
    2020-12-17 06:00

    All though this question is not the exact same as the question I posted 2 days ago, here is the result of what I was attempting to do with folders rather than a DB. The following will traverse the directory and all sub directories of the specified $path and spits out the results in a nested un-ordered list upon completion of running the script. Hope it helps.

    ";
        while ($item = readdir($dirHandle)) {
            $newPath = $path . "/" . $item;
    
            if (is_dir($newPath) && $item != '.' && $item != '..') {
                echo "
  • $item"; readDirs($newPath); } } echo "
"; } $path = "./galleries"; readDirs($path); ?>

提交回复
热议问题