Compile the document into an HTML string and save to the specified location, or return as a string.
$doc = new \hexydec\html\htmldoc();
if ($doc->load($html)) {
$doc->save($file, $options);
}
Parameter | Type | Options | Description | Default |
---|---|---|---|---|
$file |
String | The location to save the HTML, or null to return the HTML as a string |
null | |
$options |
Array | An array of output options, the input is merged with `htmldoc::$config['output']`. Note that for most scenarios, specifying this argument is not required | Array()
| |
charset |
The charset the output should be converted to. The default null will prevent any charset conversion. |
null |
||
quotestyle |
Defines how to quote the attributes in the output, either double , single , or minimal . Note that using the minify() method using the option 'quotes' => true will change the default setting to minimal |
"double" |
||
singletonclose |
A string defining how singleton tags will be closed. if false the renderer will follow the value defined in tag::$singleton , which is set by the parser. Note that using the minify() method using the option 'singleton' => true will change the default setting to > |
false |
||
closetags |
A boolean specifying whether to force elements to render a closing tag. If false , the renderer will follow the value defined in tag::$close (Which will be set according to whether the tag had no closing tag when the document was parsed, or may be set to false if the document has been minified with minify() ) |
false |
Returns the HTML document as a string if $file
is null, or true
if the file was successfully saved to the specified file. On error the method will return false
.