render() публичный Метод

public render ( string $file, array $data = null, array | boolean $expires = false, string $cache_mode = self::CACHE_USE_DEFAULT ) : boolean | string
$file string
$data array
$expires array | boolean (array for options, false for none, integer for # of seconds)
$cache_mode string
Результат boolean | string
Пример #1
0
 /**
  * Compile function.
  * @api
  * @param array   $filenames
  * @param array   $data
  * @param bool    $expires
  * @param string  $cache_mode
  * @param bool    $via_render
  * @return bool|string
  */
 public static function compile($filenames, $data = array(), $expires = false, $cache_mode = Loader::CACHE_USE_DEFAULT, $via_render = false)
 {
     if (!defined('TIMBER_LOADED')) {
         self::init();
     }
     $caller = LocationManager::get_calling_script_dir(1);
     $loader = new Loader($caller);
     $file = $loader->choose_template($filenames);
     $caller_file = LocationManager::get_calling_script_file(1);
     apply_filters('timber/calling_php_file', $caller_file);
     $output = '';
     if (is_null($data)) {
         $data = array();
     }
     if (strlen($file)) {
         if ($via_render) {
             $file = apply_filters('timber_render_file', $file);
             $data = apply_filters('timber_render_data', $data);
         } else {
             $file = apply_filters('timber_compile_file', $file);
             $data = apply_filters('timber_compile_data', $data);
         }
         $output = $loader->render($file, $data, $expires, $cache_mode);
     }
     do_action('timber_compile_done');
     return $output;
 }