• 10
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

How to get html code of DOMElement node? [duplicate]

Use the optional argument to DOMDocument::saveHTML: this says "output this element only".

return $node->ownerDocument->saveHTML($node);

Note that the argument is only available from PHP 5.3.6. Before that, you need to use DOMDocument::saveXML instead. The results may be slightly different. Also, if you already have a reference to the document, you can just do this:

$doc->saveHTML($node);
  • 75
Reply Report
      • 1
    • This is actually what I need but it's for an WordPress plugin which should work with version 3.4 and this versions requires php 5.2.4.
    • u point me to a full example? I don't have a reference of the document in the function only the node and DOMDocument::saveXML($node) is not working same as $node->saveXML($node)
      • 1
    • ok, great thanks! Is there a documentation what is different to saveHTML and which php version is required?

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions