Added ability to set template in content meta
This commit is contained in:
Gilbert Pellegrom 2013-10-23 10:39:23 +01:00
parent b2fa0a4abe
commit aa59661ff8
3 changed files with 17 additions and 5 deletions

View file

@ -1,5 +1,14 @@
*** Pico Changelog ***
2013.10.23 - version 0.8
* [New] Added ability to set template in content meta
* [New] Added before_parse_content and after_parse_content hooks
* [Changed] content_parsed hook is now depreciated
* [Changed] Moved loading the config to nearer the beginning of the class
* [Changed] Only append ellipsis in limit_words() when word count exceeds max
* [Changed] Made private methods protected for better inheritance
* [Fixed] Fixed get_protocol() method to work in more situations
2013.09.04 - version 0.7
* [New] Added before_read_file_meta and get_page_data plugin hooks to customize page meta data
* [Changed] Make get_files() ignore dotfiles

View file

@ -7,7 +7,7 @@ use \Michelf\MarkdownExtra;
* @author Gilbert Pellegrom
* @link http://pico.dev7studios.com
* @license http://opensource.org/licenses/MIT
* @version 0.7
* @version 0.8
*/
class Pico {
@ -101,8 +101,10 @@ class Pico {
'next_page' => $next_page,
'is_front_page' => $url ? false : true,
);
$this->run_hooks('before_render', array(&$twig_vars, &$twig));
$output = $twig->render('index.html', $twig_vars);
$template = (isset($meta['template']) && $meta['template']) ? $meta['template'] : 'index';
$this->run_hooks('before_render', array(&$twig_vars, &$twig, &$template));
$output = $twig->render($template .'.html', $twig_vars);
$this->run_hooks('after_render', array(&$output));
echo $output;
}
@ -156,7 +158,8 @@ class Pico {
'description' => 'Description',
'author' => 'Author',
'date' => 'Date',
'robots' => 'Robots'
'robots' => 'Robots',
'template' => 'Template'
);
// Add support for custom headers by hooking into the headers array

View file

@ -79,7 +79,7 @@ class Pico_Plugin {
}
public function before_render(&$twig_vars, &$twig)
public function before_render(&$twig_vars, &$twig, &$template)
{
}