/** * Loads a view and set it into blocks * @param string $file * @param string $view_path custom view path */ public function load($file, $view_path = null) { // is the first (main) view to load? if (empty($this->blocks)) { // set the content type $this->set_content_type($file); } // get the blocks from cache? $file_path = $this->get_view_file_path($file, $view_path); $cache_key = str_replace(DIRECTORY_SEPARATOR, '-', $file_path); $blocks = $this->cache->get_by_file($cache_key, $file_path); // do we have cached content? if (empty($blocks)) { // get the file contents $template = $this->get_file_content($file_path); // get the blocks from the template content $blocks = $this->get_blocks($template, $file); // set the blocks on cache $this->cache->set($cache_key, $blocks); } $blocks = $this->get_block_l10n($blocks, $file); // set the blocks $this->blocks = array_merge($this->blocks, $blocks); }