public function buildBlocks() { $live = live::getInstance(); $this->smarty = Core::smarty(); $blocks = array(); // Getting list of blocks $blocks_obj = new \Blocks\Block(); $blocks_data = $blocks_obj->getList(); foreach ($blocks_data as $block) { $template_file_name = $block['name'] . '.tpl'; // Getting block's data $model = '\\' . $block['module'] . '\\Controller'; $model = new $model(); $action = $block['name'] . 'Block'; if ($block_output = $model->{$action}()) { foreach ($block_output as $name => $data) { $this->smarty->assign($name, $data); } } // Templating block's data $paths = array('custom/themes/' . $this->name . '/templates/' . $block['module'], 'system/themes/' . $this->name . '/templates/' . $block['module'], 'custom/modules/' . $block['module'] . '/templates', 'system/modules/' . $block['module'] . '/templates', 'custom/modules/' . $block['module'] . '/templates'); $path = $live->findPath($paths, $template_file_name); if (!empty($path)) { $output = $this->smarty->fetch($path); if (empty($blocks[$block['region']])) { $blocks[$block['region']] = $output; } else { $blocks[$block['region']] .= $output; } } } return $blocks; }