mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 10:28:54 +00:00

s/\t/ / Cleaned See Also sections git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@157337 c90b9560-bf6c-de11-be94-00142212c4b1
91 lines
2.7 KiB
XML
91 lines
2.7 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.8 $ -->
|
|
<!-- splitted from ./en/functions/domxml.xml, last change in rev 1.38 -->
|
|
<refentry id='function.domnode-insert-before'>
|
|
<refnamediv>
|
|
<refname>DomNode->insert_before</refname>
|
|
<refpurpose>
|
|
Inserts new node as child
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>object</type><methodname>DomNode->insert_before</methodname>
|
|
<methodparam><type>object</type><parameter>newnode</parameter></methodparam>
|
|
<methodparam><type>object</type><parameter>refnode</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function inserts the new node <parameter>newnode</parameter> right
|
|
before the node <parameter>refnode</parameter>. The return value is the
|
|
inserted node. If you plan to do further modifications on the appended
|
|
child you must use the returned node.
|
|
</para>
|
|
<para>
|
|
(PHP >= 4.3 only) If <parameter>newnode</parameter> already is part of a
|
|
document, it will be first unlinked from its existing context. If
|
|
<parameter>refnode</parameter> is NULL, then <parameter>newnode</parameter>
|
|
will be inserted at the end of the list of children.
|
|
</para>
|
|
<para>
|
|
<function>domnode_insert_before</function> is very similar to
|
|
<function>domnode_append_child</function> as the following example shows
|
|
which does the same as the example at
|
|
<function>domnode_append_child</function>.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Adding a child</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
include("example.inc");
|
|
|
|
if (!$dom = domxml_open_mem($xmlstr)) {
|
|
echo "Error while parsing the document\n";
|
|
exit;
|
|
}
|
|
|
|
$elements = $dom->get_elements_by_tagname("informaltable");
|
|
print_r($elements);
|
|
$element = $elements[0];
|
|
|
|
$newnode = $element->insert_before($element, $element);
|
|
$children = $newnode->children();
|
|
$attr = $children[1]->set_attribute("align", "left");
|
|
|
|
echo "<pre>";
|
|
$xmlfile = $dom->dump_mem();
|
|
echo htmlentities($xmlfile);
|
|
echo "</pre>";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
See also <function>domnode_append_child</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|