I found several messages that refer to the problem, but none of them completely solve it.
I need a function that will output content that converts all special characters to the htmlentities () method, but retains all html tags.
I tried many different approaches, but as I mentioned above, none of them work properly.
I was wondering if there would be a way to do this using the PHP class DomDocument.
I tried to do this using the following:
$objDom = new DOMDocument('1.0', 'utf-8');
$objDom->loadhtml($content);
return $objDom->savehtml();
which works, but also adds the whole structure of the ie page
<head><body> etc.
I only need the contents of the $ content variable, which I need to convert and execute.
, , , $content , xhtml- - Wysiwyg. .., .
- , DomDocument - , ?
- - , :
$objDom = new DOMDocument('1.0', 'UTF-8');
$objDom->loadHTML($string);
$output = $objDom->saveXML($objDom->documentElement);
$output = str_replace('<html><body>', '', $output);
$output = str_replace('</body></html>', '', $output);
$output = str_replace(' ', '', $output);
return $output;
.