From aa59661ff81dd52c3a2596988372a214b0fc31b9 Mon Sep 17 00:00:00 2001 From: Gilbert Pellegrom Date: Wed, 23 Oct 2013 10:39:23 +0100 Subject: [PATCH] v0.8 Added ability to set template in content meta --- changelog.txt | 9 +++++++++ lib/pico.php | 11 +++++++---- plugins/pico_plugin.php | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 1d944eef7..6765ea7b2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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 diff --git a/lib/pico.php b/lib/pico.php index dfe1f5d70..7861d46da 100644 --- a/lib/pico.php +++ b/lib/pico.php @@ -7,7 +7,7 @@ * @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 @@ public function __construct() '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 @@ protected function read_file_meta($content) 'description' => 'Description', 'author' => 'Author', 'date' => 'Date', - 'robots' => 'Robots' + 'robots' => 'Robots', + 'template' => 'Template' ); // Add support for custom headers by hooking into the headers array diff --git a/plugins/pico_plugin.php b/plugins/pico_plugin.php index 314fe9139..a9b4432c6 100644 --- a/plugins/pico_plugin.php +++ b/plugins/pico_plugin.php @@ -79,7 +79,7 @@ public function before_twig_register() } - public function before_render(&$twig_vars, &$twig) + public function before_render(&$twig_vars, &$twig, &$template) { }