nemam vacssie problemy az na jeden, myslim ze je zbytocne to riesit ked sa tu mozno najde niekto kto uz ma skusenosti
mam XML dokument asi takyto
Kód: Vybrať všetko
<msgs>
<msg>
<name>meno</name>
<mail>[email protected]</mail>
<text>lalalalalalallaa</text>
</msg>
<msg /> ........
</msgs>
no tu sa stretavam s problemom,
myslel som ze to pojde takto
Kód: Vybrať všetko
$doc = new DOMDocument();
$doc->load('guestbook.xml');
$parent = $doc->createElement( "msg" );
$author = $doc->createElement( "name" );
$author->appendChild(
$doc->createTextNode( $comment[0] )
);
$parent->appendChild( $author );
$title = $doc->createElement( "mail" );
$title->appendChild(
$doc->createTextNode( $comment[1] )
);
$parent->appendChild( $title );
$publisher = $doc->createElement( "text" );
$publisher->appendChild(
$doc->createTextNode( $comment[2] )
);
$parent->appendChild( $publisher );
//$doc->documentElement->appendChild($parent);
$elements=$doc->get_elements_by_tagname("msg");
$doc->documentElement->insert_before($elements,$parent);
$doc->save('guestbook.xml');
neviete kde je chyba? dikiFatal error: Call to undefined method DOMDocument::get_elements_by_tagname() in /opt/lampp/htdocs/javo/write_to_xml.php on line 69