From a98fdc91be99fd1e40c5ddab4548460cfb61d605 Mon Sep 17 00:00:00 2001 From: Toni Haryanto Date: Sat, 3 Jan 2015 04:52:17 +0700 Subject: [PATCH] embed attributes while parsing --- system/application/libraries/Template.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/system/application/libraries/Template.php b/system/application/libraries/Template.php index 13705db..6642837 100755 --- a/system/application/libraries/Template.php +++ b/system/application/libraries/Template.php @@ -816,6 +816,14 @@ public function layout_exists($layout) return file_exists(self::_find_view_folder().$this->_layout_folder . $layout . self::_ext($layout)); } + // get page fields + function get_fields($field = false){ + if($field) + return isset($this->fields[$field]) ? $this->fields[$field] : ""; + + return $this->fields; + } + /** * load_view * Load views from theme paths if they exist. @@ -1100,7 +1108,7 @@ function _lex_callback($name, $attributes, $content) if(file_exists(PLUGIN_FOLDER.$plugin_name[0].'.php')){ include_once PLUGIN_FOLDER.$plugin_name[0].'.php'; $plugin = new $plugin_name[0](); - $data = call_user_func_array(array($plugin, $plugin_name[1]), array()); + $data = call_user_func_array(array($plugin, $plugin_name[1]), $attributes); if(is_array($data)) $return .= $this->_lexparser->parse($content, $data, array($this, '_lex_callback')); @@ -1124,13 +1132,6 @@ function _lex_callback($name, $attributes, $content) return ($return)?$return:false; } - // get page fields - function get_fields($field = false){ - if($field) - return isset($this->fields[$field]) ? $this->fields[$field] : ""; - - return $this->fields; - } } // END Template class \ No newline at end of file