sub doNavigation { my $root = $_[0]; my $select = "f2c_id,f2c_fatherid"; my $from = "t_father2child"; my $where = "f2c_id = $root"; my @fathers = doSelect($select,$from,$where); my $fatherId = $fathers[0][1]; loop($root,$fatherId); } # end sub sub loop { my $root = $_[0]; my $father = $_[1]; my $select = "f2c_id,f2c_fatherid,f2c_childid,element_titel"; my $from = "(t_father2child INNER JOIN t_element ON f2c_ChildId = element_id)"; my $where = "f2c_fatherid = $father AND f2c_NodeTypeId = 1"; my @nodes = doSelect($select,$from,$where); foreach my $node (0..$#nodes) { print "
- $nodes[$node][1] - $nodes[$node][2] - $nodes[$node][3]"; if ($nodes[$node][0] == $root) { my $select = "f2c_id,f2c_fatherid,f2c_childid,element_titel"; my $from = "(t_father2child INNER JOIN t_element ON f2c_ChildId = element_id)"; my $where = "f2c_fatherid = $nodes[$node][2] AND f2c_NodeTypeId = 1"; my @children = doSelect($select,$from,$where); if (@children) { loop($root,$children[0][1]); } # end children-if } # end node-if } # end node-foreach }