Reference - Data types - html


App: regression/pages - Page: misc/datatypes
PHP
misc/datatypes.php
HTML
misc/datatypes.pad
Result
<?php

// The two data types nothing else parses. The html type runs the input through tidy into
// well-formed XML and then the XML parser; the tree nests by element, so the PHP half
// walks to the values and the template prints them. The range type is template-side.

$tree = padData ( '<html><head><title>T</title></head><body><p>alpha</p><p>beta</p></body></html>', 'html' );

$title = $tree ['head'] [0] ['title'] ?? '?';
$paras = implode ( ',', $tree ['body'] [0] ['p'] ?? [] );

?>
html title: {$title}
html paragraphs: {$paras}
range: {data 'dr'}5..9{/data}{dr}{$dr} {/dr}
range letters: {data 'dl', type='range'}p..t{/data}{dl}{$dl}{/dl}