on-internet
← Community

PHP DOMDocument stripping HTML tags

Stack Overflow ·

I'm working on a small templating engine, and I'm using DOMDocument to parse the pages. My test page so far looks like this: <block name="content"> <?php echo 'this is some rendered PHP! <br />' ?> <p>Main column of <span>content</span></p> </block> And part of my class looks like this: private function parse($tag, $attr = 'name') { $strict = 0; /*** the array to return ***/ $out = array(); if($this->totalBlocks() > 0) { /*** a new dom object ***/ $dom = new domDocument; /*** discard white space ***/ $dom->preserveWhiteSpace = false; /*** load the html into the object ***/ if($strict==1) { $do

Comments

Sign in or sign up to comment and upvote.

No comments yet.