123456789101112131415161718192021222324 |
- <?php
- require_once(__DIR__.SLASH.'TextExport.class.php');
- class HtmlExport extends TextExport{
- public static $mime = 'text/html';
- public static $extension = 'html';
- public static $description = 'Fichier page web HTML';
- public static function sample($dataset){
- $stream = '<!DOCTYPE html><html lang="fr"><head><meta charset="utf-8"></head><body>';
- foreach($dataset as $macro => $infos)
- $stream .= ($infos['type']=='list') ? '{{#'.$macro.'}}{{/'.$macro.'}} : '.$infos['desc'].'<br>' : '{{'.$macro.'}} : '.$infos['desc'].'<br>'.PHP_EOL;
- $stream .= '</body></html>';
- return $stream;
- }
- public static function from_template($source, $data, $return, $isHtml=true){
- $htmlRaw = TextExport::from_template($source, $data, $return, $isHtml);
- $stream = $return=='stream' ? $htmlRaw : file_get_contents($htmlRaw);
- if($return!='stream') return $htmlRaw;
- return $stream;
- }
- }
- ?>
|