+
+ function BuscarHijos($id)
+ {
+ $sql = "SELECT $this->nombre, $this->id ";
+ if(!is_null($this->link))
+ $sql .= ", $this->link ";
+ $sql .= "FROM $this->tabla ";
+ if(!is_null($this->padre) or $this->where)
+ $sql .= 'WHERE ';
+ if(!is_null($this->padre)) {
+ $sql .= "$this->padre = '$id'";
+ if ($this->where)
+ $sql .= ' AND';
+ } elseif ($this->where)
+ $sql .= $this->where;
+ $sql .= $this->order;
+ $result = $this->db->query($sql);
+ if(DB::isError($result))
+ die($result->getMessage());
+ $dat = array();
+ while($row = $result->fetchRow())
+ {
+ $titulo = $row[0];
+ $id = $row[1];
+ if(is_null($this->padre)) $sub = array();
+ else $sub = $this->BuscarHijos($id);
+ if(!is_null($this->link)) $link = $this->prepend_link.$row[2];
+ else $link = $this->prepend_link.$id;
+ $dat[] = array(
+ 'titulo'=> $titulo,
+ 'link' => $link,
+ 'sub' => $sub
+ );
+ }
+ return $dat;