I create some HTML Templates with php doms functionality, now i like to add some php tags into my template i.e.
$input = $this->dom->createElement(\'in
You need a Processing Instruction
$php = $dom->createProcessingInstruction('php', 'echo $foo->bar;');
Full example:
$dom = new DOMDocument;
$dom->loadXml('<html><head><title>Test</title></head><body/></html>');
$dom->getElementsByTagName('body')->item(0)->appendChild(
$dom->createProcessingInstruction('php', 'echo $foo->bar;')
);
$dom->format = TRUE;
echo $dom->saveXML();
Result:
<?xml version="1.0"?>
<html>
<head>
<title>Test</title>
</head>
<body>
<?php echo $foo->bar;?>
</body>
</html>