I have this Class
Class Parser extends DOMDocument {
public function setHTML($file) {
$this->loadHTMLFile($file);
}
public function setAttribute($name, $value) {
return $this->setAttribute($name, $value);
}
public function findById($id) {
return $this->getElementById($id);
}
}
and I use it like this:
$parser = new Parser();
$parser->setHTML('as.html');
$parser->findById("xaxa")->setAttribute('name1', 'value1');
but if I have to see the changed HTML I call SAVEHTML like this
echo $parser->saveHTML();
Is there a way to make it automatic? Like when method setAttribute is called to make
$this->saveHTML()
auto so I will have this
$html =$parser->findById("xaxa")->setAttribute('name1', 'value1');
then call
echo $html;
Thanks alot