Ability to set custom layout using meta.layout
This commit is contained in:
parent
ec37ff4e75
commit
4ad6539ec5
1 changed files with 10 additions and 5 deletions
15
lib/pico.php
15
lib/pico.php
|
@ -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 {
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Add table
Reference in a new issue