You are here

function Smarty::_compile_resource in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/lib/smarty/Smarty.class.php \Smarty::_compile_resource()

compile the template

Parameters

string $resource_name:

string $compile_path:

Return value

boolean

2 calls to Smarty::_compile_resource()
Smarty::fetch in includes/moodle/lib/smarty/Smarty.class.php
executes & returns or displays the template results
Smarty::_smarty_include in includes/moodle/lib/smarty/Smarty.class.php

File

includes/moodle/lib/smarty/Smarty.class.php, line 1405

Class

Smarty
@package Smarty

Code

function _compile_resource($resource_name, $compile_path) {
  $_params = array(
    'resource_name' => $resource_name,
  );
  if (!$this
    ->_fetch_resource_info($_params)) {
    return false;
  }
  $_source_content = $_params['source_content'];
  $_cache_include = substr($compile_path, 0, -4) . '.inc';
  if ($this
    ->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) {

    // if a _cache_serial was set, we also have to write an include-file:
    if ($this->_cache_include_info) {
      require_once SMARTY_CORE_DIR . 'core.write_compiled_include.php';
      smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array(
        'compiled_content' => $_compiled_content,
        'resource_name' => $resource_name,
      )), $this);
    }
    $_params = array(
      'compile_path' => $compile_path,
      'compiled_content' => $_compiled_content,
    );
    require_once SMARTY_CORE_DIR . 'core.write_compiled_resource.php';
    smarty_core_write_compiled_resource($_params, $this);
    return true;
  }
  else {
    return false;
  }
}