本文整理匯總了PHP中DOMText::appendChild方法的典型用法代碼示例。如果您正苦於以下問題:PHP DOMText::appendChild方法的具體用法?PHP DOMText::appendChild怎麽用?PHP DOMText::appendChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DOMText
的用法示例。
在下文中一共展示了DOMText::appendChild方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
/**
* Inserts a new child immediately after the specified frame
*
* @param $new_child Frame The new Frame to insert
* @param $ref Frame The Frame before the new Frame
* @param $update_node boolean Whether or not to update the DOM
*
* @throws DOMPDF_Exception
*/
function insert_child_after(Frame $new_child, Frame $ref, $update_node = true)
{
if ($ref === $this->_last_child) {
$this->append_child($new_child, $update_node);
return;
}
if (is_null($ref)) {
$this->prepend_child($new_child, $update_node);
return;
}
if ($ref->_parent !== $this) {
throw new DOMPDF_Exception("Reference child is not a child of this node.");
}
// Update the node
if ($update_node) {
if ($ref->_next_sibling) {
$next_node = $ref->_next_sibling->_node;
$this->_node->insertBefore($new_child->_node, $next_node);
} else {
$new_child->_node = $this->_node->appendChild($new_child->_node);
}
}
// Remove the child from its parent
if ($new_child->_parent) {
$new_child->_parent->remove_child($new_child, false);
}
$new_child->_parent = $this;
$new_child->_prev_sibling = $ref;
$new_child->_next_sibling = $ref->_next_sibling;
if ($ref->_next_sibling) {
$ref->_next_sibling->_prev_sibling = $new_child;
}
$ref->_next_sibling = $new_child;
}