forked from HttpErrorPages/HttpErrorPages
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerator.php
More file actions
31 lines (24 loc) · 685 Bytes
/
generator.php
File metadata and controls
31 lines (24 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
* HttpErrorPages HTML Generator
*/
$config = array(
'footer' => 'Contact technique: <a href="mailto:[email protected]">[email protected]</a>'
);
// load pages
$pages = require('pages.php');
// load inline css
$css = trim(file_get_contents('Resources/Layout.css'));
// generate each error page
foreach ($pages as $code => $page){
// assign variables
$v_code = intval($code);
$v_title = nl2br(htmlspecialchars($page['title']));
$v_message = nl2br(htmlspecialchars($page['message']));
// render template
ob_start();
require('template.phtml');
$errorpage = ob_get_clean();
// store template
file_put_contents('Build/'.$v_code.'.html', $errorpage);
}