I have built this tree script for my navigation on my school website, but it won't get past the third level. For example, this page below should be:
Home
About Our Schools > Schools > High School > General Information

But it comes out only:
Home
About Our Schools > Schools > High School

Can someone please help?
PHP Code:
class Tree {

var 
$array_parent;
var 
$array_page;
var 
$array_asc;
var 
$i;
function 
Tree() {
global 
$cfg;

$temp '-1';
$i '0';
$sql = new SQL("SELECT pageID, parentID, treetitle, url, ordernum, treestatus FROM " $cfg['sql']['prefix'] . "pages ORDER BY parentID, ordernum ASC" );
while(
$row $sql->fetch_result()) {
if (
$temp != $row['parentID']) {
$temp $row['parentID'];
$i '0';
}
$this->array_parent[$row['parentID']][$i] = $row['pageID'];
$this->array_page[$row['pageID']]['pageID'] = $row['pageID'];
$this->array_page[$row['pageID']]['parentID'] = $row['parentID'];
$this->array_page[$row['pageID']]['treetitle'] = $row['treetitle'];
$this->array_page[$row['pageID']]['url'] = $row['url'];
$this->array_page[$row['pageID']]['treestatus'] = $row['treestatus'];
$i++;
}
}

function 
make_tree($pageID$parentID='1') {
$this->setup_tree($pageID$parentID);
$this->'2';
if(isset(
$this->array_asc[1])) {
$this->make_list($this->array_asc[0], $this->array_asc[1]);
} else {
$this->make_list($this->array_asc[0]);
}
}

function 
setup_tree($pageID$parentID='1') {
$temp $pageID;
$this->array_asc = array();
while(
$temp != $parentID) {
$this->array_asc array_merge($this->array_asc, array($this->array_page[$temp]['parentID']));
$temp $this->array_page[$temp]['parentID'];
}
$this->array_asc array_merge(array($pageID),$this->array_asc);

$this->array_asc array_reverse($this->array_asc);
}


function 
make_list($parentID$pageID='') {
echo(
'<ul>');
if(
$parentID == '1') { echo('<li><a href="' format_url($this->array_page['1']['url']) . '">' $this->array_page['1']['treetitle'] . '</a></li>'); }
if(
array_key_exists($parentID$this->array_parent)) {
foreach(
$this->array_parent[$parentID] as $value) {
echo(
'<li><a href="' format_url($this->array_page[$value]['url']) . '">' $this->array_page[$value]['treetitle'] . '</a></li>');
if(
$value == $pageID) {
if(
array_key_exists($this->i$this->array_asc)) {
$this->make_list($pageID$this->array_asc[$this->i]);
} else {
$this->make_list($pageID);
}
$this->i++;
} elseif (
$this->array_page[$value]['treestatus'] == '2') {
$this->make_list($this->array_page[$value]['pageID']);
}
}
}
echo(
'</ul>');
}
}

$tree = new Tree();

$tree->make_tree('25'); 
Code:
$this->array_parent Array
(
	[] => Array
		(
			[0] => 1
		)
	[1] => Array
		(
			[0] => 2
			[1] => 3
			[2] => 4
			[3] => 7
			[4] => 8
			[5] => 9
			[6] => 10
		)
	[3] => Array
		(
			[0] => 5
			[1] => 6
			[2] => 11
		)
	[5] => Array
		(
			[0] => 19
			[1] => 20
			[2] => 21
			[3] => 22
		)
	[6] => Array
		(
			[0] => 17
			[1] => 16
			[2] => 18
		)
	[11] => Array
		(
			[0] => 12
			[1] => 13
			[2] => 14
			[3] => 15
		)
	[12] => Array
		(
			[0] => 25
		)
	[17] => Array
		(
			[0] => 24
		)
	[22] => Array
		(
			[0] => 23
		)
)
 
$this->array_page Array
(
	[1] => Array
		(
			[pageID] => 1
			[parentID] => 
			[treetitle] => Home
			[url] => index.php
			[treestatus] => 1
		)
	[2] => Array
		(
			[pageID] => 2
			[parentID] => 1
			[treetitle] => What's New
			[url] => new/
			[treestatus] => 1
		)
	[3] => Array
		(
			[pageID] => 3
			[parentID] => 1
			[treetitle] => About Our Schools
			[url] => ourschools/
			[treestatus] => 1
		)
	[4] => Array
		(
			[pageID] => 4
			[parentID] => 1
			[treetitle] => Technology
			[url] => technology/
			[treestatus] => 1
		)
	[7] => Array
		(
			[pageID] => 7
			[parentID] => 1
			[treetitle] => School Leadership
			[url] => leadership/
			[treestatus] => 1
		)
	[8] => Array
		(
			[pageID] => 8
			[parentID] => 1
			[treetitle] => Athletics
			[url] => athletics/
			[treestatus] => 1
		)
	[9] => Array
		(
			[pageID] => 9
			[parentID] => 1
			[treetitle] => Resources
			[url] => resources/
			[treestatus] => 1
		)
	[10] => Array
		(
			[pageID] => 10
			[parentID] => 1
			[treetitle] => Employment
			[url] => employment/
			[treestatus] => 1
		)
	[5] => Array
		(
			[pageID] => 5
			[parentID] => 3
			[treetitle] => General Information
			[url] => ourschools/information/
			[treestatus] => 1
		)
	[6] => Array
		(
			[pageID] => 6
			[parentID] => 3
			[treetitle] => Health Services
			[url] => ourschools/health/
			[treestatus] => 1
		)
	[11] => Array
		(
			[pageID] => 11
			[parentID] => 3
			[treetitle] => Schools
			[url] => ourschools/schools/
			[treestatus] => 2
		)
	[19] => Array
		(
			[pageID] => 19
			[parentID] => 5
			[treetitle] => District Facts
			[url] => ourschools/information/facts/
			[treestatus] => 1
		)
	[20] => Array
		(
			[pageID] => 20
			[parentID] => 5
			[treetitle] => Board of Trustees
			[url] => ourschools/information/board/
			[treestatus] => 1
		)
	[21] => Array
		(
			[pageID] => 21
			[parentID] => 5
			[treetitle] => DWEIC
			[url] => ourschools/information/dweic/
			[treestatus] => 1
		)
	[22] => Array
		(
			[pageID] => 22
			[parentID] => 5
			[treetitle] => Construction Update
			[url] => ourschools/information/construction/
			[treestatus] => 1
		)
	[17] => Array
		(
			[pageID] => 17
			[parentID] => 6
			[treetitle] => Attendance Guidelines
			[url] => ourschools/health/attendance/
			[treestatus] => 1
		)
	[16] => Array
		(
			[pageID] => 16
			[parentID] => 6
			[treetitle] => Medication Information
			[url] => ourschools/health/medication/
			[treestatus] => 1
		)
	[18] => Array
		(
			[pageID] => 18
			[parentID] => 6
			[treetitle] => Immunization Requirements
			[url] => ourschools/health/requirements/
			[treestatus] => 1
		)
	[12] => Array
		(
			[pageID] => 12
			[parentID] => 11
			[treetitle] => High School
			[url] => ourschools/schools/hs/
			[treestatus] => 1
		)
	[13] => Array
		(
			[pageID] => 13
			[parentID] => 11
			[treetitle] => Middle School
			[url] => ourschools/schools/ms/
			[treestatus] => 1
		)
	[14] => Array
		(
			[pageID] => 14
			[parentID] => 11
			[treetitle] => Intermediate School
			[url] => ourschools/schools/is/
			[treestatus] => 1
		)
	[15] => Array
		(
			[pageID] => 15
			[parentID] => 11
			[treetitle] => Elementary School
			[url] => ourschools/schools/es/
			[treestatus] => 1
		)
	[25] => Array
		(
			[pageID] => 25
			[parentID] => 12
			[treetitle] => General Information
			[url] => ourschools/schools/hs/information
			[treestatus] => 1
		)
	[24] => Array
		(
			[pageID] => 24
			[parentID] => 17
			[treetitle] => asdf
			[url] => index.php
			[treestatus] => 1
		)
	[23] => Array
		(
			[pageID] => 23
			[parentID] => 22
			[treetitle] => Construction Cam
			[url] => buildingcams.gallagher-construction.com
			[treestatus] => 1
		)
)