pohja = new Domdocument( "1.0", "UTF-8" ); $this->pohja -> formatOutput = true; //rakennetaan pohja: $this->insertElement(Array("","html","html","html","","")); $this -> insertElement(Array("html","head","head","","")); $this -> insertElement(Array("html","body","body","","")); $this->insertElement(Array("head","title","title","",$title)); foreach( $floor as $arr){ $this-> insertElement($arr); } } //mihin,nimi,tyyppi,atribuutit,sisältö public function insertElement($element){ if($element[4]==""){ $this->elements[$element[1]] = $this->pohja-> createElement($element[2]); } else{ $this->elements[$element[1]] = $this->pohja-> createElement($element[2],$element[4]); } if($element[3] !=""){ foreach($element[3] as $key => $value){ $this->elements[1]->setAttribute($key,$value); } } if($element[0]==""){ $this->pohja->appendChild($elements[$element[1]]); } $this->elements[$element[0]]->appendChild($elements[$element[1]]); } public function naytasivu(){ echo $this->pohja->saveXML(); } } ?>