Ability to set custom layout using meta.layout

This commit is contained in:
Ahmad Samiei 2013-08-04 00:16:21 +04:30
parent ec37ff4e75
commit 4ad6539ec5

View file

@ -98,7 +98,11 @@ class Pico {
'is_front_page' => $url ? false : true,
);
$this->run_hooks('before_render', array(&$twig_vars, &$twig));
$output = $twig->render('index.html', $twig_vars);
if (isset($meta['layout']) && ! empty($meta['layout'])) {
$output = $twig->render($meta['layout'], $twig_vars);
} else {
$output = $twig->render('index.html', $twig_vars);
}
$this->run_hooks('after_render', array(&$output));
echo $output;
}
@ -150,9 +154,10 @@ class Pico {
$headers = array(
'title' => 'Title',
'description' => 'Description',
'author' => 'Author',
'date' => 'Date',
'robots' => 'Robots'
'author' => 'Author',
'date' => 'Date',
'robots' => 'Robots',
'layout' => 'Layout'
);
foreach ($headers as $field => $regex){
@ -336,4 +341,4 @@ class Pico {
}
?>
?>