Merge footer and header into a single file (layout.php)

This commit is contained in:
Frédéric Guillot 2013-10-06 17:33:37 -04:00
parent de8133b7ee
commit bd477be736
3 changed files with 12 additions and 15 deletions

View File

@ -1,3 +0,0 @@
</section>
</body>
</html>

View File

@ -3,12 +3,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="icon" type="image/png" href="./assets/img/favicon.png">
<link rel="icon" type="image/png" href="assets/img/favicon.png">
<link rel="shortcut icon" href="favicon.ico">
<link rel="apple-touch-icon" href="./assets/img/touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="72x72" href="./assets/img/touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="114x114" href="./assets/img/touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="144x144" href="./assets/img/touch-icon-ipad-retina.png">
<link rel="apple-touch-icon" href="assets/img/touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/img/touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/img/touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="144x144" href="assets/img/touch-icon-ipad-retina.png">
<title><?= isset($title) ? Helper\escape($title) : 'miniflux' ?></title>
<link href="<?= Helper\css() ?>" rel="stylesheet" media="screen">
<script type="text/javascript" src="assets/js/app.js?version=<?= filemtime('assets/js/app.js') ?>" defer></script>
@ -42,3 +42,7 @@
<section class="page">
<?= Helper\flash('<div class="alert alert-success">%s</div>') ?>
<?= Helper\flash_error('<div class="alert alert-error">%s</div>') ?>
<?= $content_for_layout ?>
</section>
</body>
</html>

View File

@ -45,11 +45,7 @@ function load()
}
function layout($template_name, array $template_args = array())
function layout($template_name, array $template_args = array(), $layout_name = 'layout')
{
$output = load('app_header', $template_args);
$output .= load($template_name, $template_args);
$output .= load('app_footer', $template_args);
return $output;
return load($layout_name, $template_args + array('content_for_layout' => load($template_name, $template_args)));
}