Created
April 22, 2013 20:24
-
-
Save drmmr763/5438198 to your computer and use it in GitHub Desktop.
Little php based recursion function for putting together a list of folders in html.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
** recursive function which builds child / parent option list of | |
** select list options | |
*/ | |
public function getSubfoldersList($parent_id) | |
{ | |
$model = new BoxsearchModelBoxsearch(); | |
$subfolders = $model->getSubFolders($parent_id); | |
$opts = ''; | |
foreach($subfolders as $folder) { | |
$opts = '<option value="' . $folder->id . '"> . "-" ' . $folder->name . '</option>'; | |
if ($model->getSubFolders($folder->id)) { | |
$opts .= getSubfoldersList($folder->id); | |
} | |
} | |
return $opts; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment