php-doc-en/reference/dom/domdocument/savehtml.xml
2021-01-02 16:32:41 +01:00

106 lines
2.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="domdocument.savehtml" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>DOMDocument::saveHTML</refname>
<refpurpose>
Dumps the internal document into a string using HTML formatting
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type class="union"><type>string</type><type>false</type></type><methodname>DOMDocument::saveHTML</methodname>
<methodparam choice="opt"><type class="union"><type>DOMNode</type><type>null</type></type><parameter>node</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
Creates an HTML document from the DOM representation. This function is usually
called after building a new dom document from scratch as in the example below.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>node</parameter></term>
<listitem>
<para>
Optional parameter to output a subset of the document.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the HTML, or &false; if an error occurred.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Saving a HTML tree into a string</title>
<programlisting role="php">
<![CDATA[
<?php
$doc = new DOMDocument('1.0');
$root = $doc->createElement('html');
$root = $doc->appendChild($root);
$head = $doc->createElement('head');
$head = $root->appendChild($head);
$title = $doc->createElement('title');
$title = $head->appendChild($title);
$text = $doc->createTextNode('This is the title');
$text = $title->appendChild($text);
echo $doc->saveHTML();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>DOMDocument::saveHTMLFile</methodname></member>
<member><methodname>DOMDocument::loadHTML</methodname></member>
<member><methodname>DOMDocument::loadHTMLFile</methodname></member>
</simplelist>
</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:"~/.phpdoc/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
-->