RE: recursive

From: Date: Mon, 21 Jan 2002 14:51:55 +0000
Subject: RE: recursive
Groups: php.general 
Request: Send a blank email to php-general+get-81366@lists.php.net to get a copy of this message
I'm not quite sure what you're having difficulty with, but this is, in principle, like mapping a file system structure ... which I do like this: function sitemap($path) { if ($dhandle = opendir($path)) { echo("<ul>"); while ($file_name = readdir($dhandle)) { if ($file_name == "." or $file_name == "..") continue; echo("<li>$file_name</li>"); if (is_dir("$path$file_name")) sitemap("$path$file_name/"); } closedir($dhandle); echo("</ul>"); } } // end of fn sitemap this shows the general principle, if you're already getting the top level okay you should be able to use this sort of thing to get the rest Tim www.chessish.com <http://www.chessish.com> ---------- From: Sandeep Murphy [SMTP:Sandeep.Murphy@oni.pt] Sent: 21 January 2002 11:27 To: php-general@lists.php.net Subject: recursive hi, I hv an XML tree with some elements which keep repeating.. As of now, I am able to print only the last element.. I need to make the loop recursive in order to print all the elements.. wud appreciate any help.. TIA, sands like this: <app_info> <app_id>001</app_id> <app_name>WORD</app_name> <app_info> <app_id>002</app_id> <app_name>excel</app_name> </app_info> <app_info> <app_id>003</app_id> <app_name>PPt</app_name> </app_info> </app_info> <app_info> <app_id>004</app_id> <app_name>ZIP</app_name> </app_info>

« previous php.general (#81366) next »