function find_comments($comments, $parent_id, $lvl = 0) { for ($i = 0; $i < count($comments); $i++) { $comment = $comments[$i]; if ($comment['parent_id'] == $parent_id) { show_comment($comment, $lvl); find_comments($comments, $comment['id'], $lvl + 1); // echo '</div>'; //the comment div stays open until there are no more children } } }
$PAGE->page_start(); $PAGE->stripe_start(); $PAGE->search_form(); $o = get_http_var('o'); $args = array('s' => $searchstring, 'p' => $pagenum, 'num' => get_http_var('num'), 'pop' => get_http_var('pop'), 'o' => $o == 'd' || $o == 'r' ? $o : 'd'); $LIST = new HANSARDLIST(); if ($args['s']) { $db = $LIST->db; find_members($args); } $LIST->display('search', $args); if ($args['s']) { find_constituency($args); # find_users($args); find_glossary_items($args); find_comments($args); } } } else { // No search term. Display help. $this_page = 'search_help'; $PAGE->page_start(); $PAGE->stripe_start(); include INCLUDESPATH . 'easyparliament/staticpages/search_help.php'; } $PAGE->stripe_end(array(array('type' => 'include', 'content' => 'search_links'), array('type' => 'include', 'content' => 'search'))); $PAGE->page_end(); function find_comments($args) { global $PAGE, $db; $commentlist = new COMMENTLIST();