forked from paquettg/php-html-parser
-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
questionFurther information is requestedFurther information is requested
Description
I want to wrap a child element of a site with an template.
$dom = new Dom;
$dom->load('site.html');
foreach($dom->find('node') as $node) {
$tmpl = new Dom;
$tmpl->load('template.html');
$tmpl->find('*[id=container])[0]->addChild($node)
$node->getParent()->replaceChild($node->id(),$tmpl->root);
}However I think (even if the replaceChild method works) the output will not be as expected. We add $node as child to the root of $tmpl. But what happens, when I replace $node with $tmpl?
Will $node, as child of $tmpl also get deleted? I am thinking about what is passed by value or reference and PHP handles that often very unclear ...
For wrapping also a custom function could be considered, if the above question answers with yes.
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested