Ciao a tutti. Ho problemi col DOM. Ho questa classe:
Codice PHP:
class News extends DomDocument {
function __construct() {
//has to be called!
parent::__construct();
}
function addArticle($hl) {
$item = $this->createElement("article");
$headline = $this->createElement("headline");
$headlinetext = $this->createTextNode($hl);
$headline->appendChild($headlinetext);
$item->appendChild($headline);
//$a = create_attribute("align", "left");
//$this->documentElement->appendChild($a);
$this->documentElement->appendChild($item);
}
}
Non riesco a creare l'attributo al nodo padre "article". Le righe che uso sono quelle commentate, ma quando decommento non funziona la pagina.
Un aiuto???