/*!
Loads the template file if it exists, also sets the modification timestamp.
Returns true if the file exists.
486793
function handleResource( $tpl, &$resourceData, $method, &$extraParameters )
    {
        $path = $resourceData['template-name'];

        $matchKeys = $this->Keys;
        if ( isset( $GLOBALS['eZDesignKeys'] ) )
        {
            $matchKeys = array_merge( $matchKeys, $GLOBALS['eZDesignKeys'] );
            unset( $GLOBALS['eZDesignKeys'] );
            $this->Keys = $matchKeys;
        }
        if ( is_array( $extraParameters ) and
             isset( $extraParameters['ezdesign:keys'] ) )
        {
            $this->mergeKeys( $matchKeys, $extraParameters['ezdesign:keys'] );
        }
        $this->KeyStack[] = $this->Keys;
        $this->Keys = $matchKeys;

        eZDebug::accumulatorStart( 'override_cache', 'Override', 'Cache load' );

        if( !isset( $GLOBALS['eZOverrideTemplateCacheMap'] ) )
        {
            $overrideCacheFile = $this->createOverrideCache();

            if ( $overrideCacheFile )
            {
                include_once( $overrideCacheFile );
            }
        }

        if ( isset( $GLOBALS['eZOverrideTemplateCacheMap'] ) )
        {
            if( isset( $GLOBALS['eZOverrideTemplateCacheMap'][md5( '/' . $path )] ) )
            {
                $cacheMap = $GLOBALS['eZOverrideTemplateCacheMap'][md5( '/' . $path )];
                if ( !is_string( $cacheMap ) and trim( $cacheMap['code'] ) )
                {
                    eval( "\$matchFile = " . $cacheMap['code'] . ";" );
                }
                else
                {
                    $matchFile = $cacheMap;
                }
                $match['file'] = $matchFile;
            }
        }
        else
        {
            $template = "/" . $path;
            $matchFileArray = eZTemplateDesignResource::overrideArray( $this->OverrideSiteAccess );

            $matchFile = $matchFileArray[$template];

            if ( isset( $matchFile['custom_match'] ) )
            {
                $matchFound = false;
                foreach ( $matchFile['custom_match'] as $customMatch )
                {
                    $matchOverride = true;
                    if ( count( $customMatch['conditions'] ) > 0 )
                    {
                        foreach ( array_keys( $customMatch['conditions'] ) as $conditionKey )
                        {
                            // Create special substring match for subtree override
                            if ( $conditionKey == 'url_alias' )
                            {
                                if ( strpos( $matchKeys['url_alias'], $customMatch['conditions'][$conditionKey] ) === 0 )
                                {
                                }
                                else
                                {
                                    $matchOverride = false;
                                }
                            }
                            else if ( isset( $matchKeys[$conditionKey] ) and
                                      isset( $customMatch['conditions'][$conditionKey] ) )
                            {
                                if ( is_array( $matchKeys[$conditionKey] ) )
                                {
                                    if ( !in_array( $customMatch['conditions'][$conditionKey], $matchKeys[$conditionKey] ) )
                                    {
                                        $matchOverride = false;
                                    }
                                }
                                else if ( $matchKeys[$conditionKey] != $customMatch['conditions'][$conditionKey] )
                                {
                                    $matchOverride = false;
                                }
                            }
                            else
                            {
                                $matchOverride = false;
                            }
                        }
                        if ( $matchOverride == true )
                        {
                            $match['file'] = $customMatch['match_file'];
                            $matchFound = true;
                            break;
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                        // Default match without conditions
                        $match['file'] = $customMatch['match_file'];
                        $matchFound = true;
                    }
                }
                if ( !$matchFound )
                    $match['file'] = $matchFile['base_dir'] . $matchFile['template'];
            }
            else
            {
                $match['file'] = $matchFile['base_dir'] . $matchFile['template'];
            }
        }
        eZDebug::accumulatorStop( 'override_cache' );
        if ( isset( $match ) )
        {
            $file = $match["file"];

            $matchedKeys = array();
            $usedKeys = array();
            foreach ( $matchKeys as $matchKeyName => $matchKeyValue )
            {
                $usedKeys[$matchKeyName] = $matchKeyValue;
            }
            $extraParameters['ezdesign:used_keys'] = $usedKeys;
            $extraParameters['ezdesign:matched_keys'] = $matchedKeys;
            $tpl->setVariable( 'used', $usedKeys, 'DesignKeys' );
            $tpl->setVariable( 'matched', $matchedKeys, 'DesignKeys' );
            $resourceData['template-filename'] = $file;
            $result = eZTemplateFileResource::handleResourceData( $tpl, $this, $resourceData, $method, $extraParameters );
        }
        else
        {
            $result = false;
        }
        $this->Keys = array_pop( $this->KeyStack );
        return $result;
    }
785235
function cacheTemplate(fn, options) {
  if (options.cache && options.filename) {
    cache[options.filename] = fn;
  }
}
498530
public function load_template( $params ) {

		if ( ! class_exists( 'Pods_Templates' ) ) {
			return false;
		}

		$params       = (object) $params;
		$params->type = 'template';

		return $this->load_object( $params );
	}
85058
function _loadFile(filename){
  var module = require(filename);
  delete require.cache[require.resolve(filename)];
  return module;
}
858746
def load
      @load_time = Time.now
      @meta = {}
      if template?
        logger.debug "loading #{path}"
        file.open do |io|
          read_meta(io)
          @template_start_line = io.lineno + 1
          @template_text = io.read
        end
      end
    end
163822
function loadfile($handle)
    {
        // If the file for this handle is already loaded and compiled, do nothing.
        if (isset($this->uncompiled_code[$handle]) && !empty($this->uncompiled_code[$handle])) {
            return true;
        }

        // If we don't have a file assigned to this handle, die.
        if (!isset($this->files[$handle])) {
            die("Template->loadfile(): Aucun fichier spécifié pour le modèle". $handle);
        }

        $filename = $this->files[$handle];

        $str = implode("", @file($filename)); 
        if (empty($str)) {
            die("Template->loadfile(): Le fichier $filename pour le modèle $handle est vide");
        }

        $this->uncompiled_code[$handle] = $str;

        return true;
    }
197252
function compileTemplateFile( $file, $returnResourceData = false )
    {
        $this->resetErrorLog();

        if ( !file_exists( $file ) )
            return false;
        $resourceHandler = $this->resourceFor( $file, $resourceName, $templateName );
        if ( !$resourceHandler )
            return false;
        $resourceData = $this->resourceData( $resourceHandler, $file, $resourceName, $templateName );
        $resourceData['key-data'] = "file:" . $file;
        $key = md5( $resourceData['key-data'] );
        $extraParameters = array();
        $resourceHandler->handleResource( $this, $resourceData, eZTemplate::RESOURCE_FETCH, $extraParameters );

        $isCompiled = false;
        if ( isset( $resourceData['compiled-template'] ) )
            $isCompiled = $resourceData['compiled-template'];

        if ( !$isCompiled )
        {
            $root =& $resourceData['root-node'];
            $root = array( eZTemplate::NODE_ROOT, false );
            $templateText = $resourceData["text"];
            $rootNamespace = '';
            $this->parse( $templateText, $root, $rootNamespace, $resourceData );
            if ( eZTemplate::isDebugEnabled() )
            {
                $this->appendDebugNodes( $root, $resourceData );
            }

            $result = eZTemplateCompiler::compileTemplate( $this, $key, $resourceData );
        }
        else
        {
            $result = true;
        }

        if ( $returnResourceData )
        {
            $resourceData['result'] = $result;
            return $resourceData;
        }
        return $result;
    }
407541
function load($url) {
            if (empty($url)) return false;
            $this->parseXML(implode('', @file($url)));
        }
1368258
static function upToDate($src, $dest)
    {
        if (!file_exists($dest)) {
            return false;
        }

        if (filemtime($dest) >= filemtime($src)) {
            return true;
        }
        return false;
    }
1132355
function loadTemplate (file, options) {
    // return cached template if caching enabled
    if (options.cache && GLOBAL.templates[file]) {
        return Promise.resolve(GLOBAL.templates[file])
    }
    // store promise to load template
    var promise = GLOBAL.templates[file] = fsp.readFile(file, 'utf8')
    // compile template file
    .then(data => {
        // replace entry in template cache with template function
        var template = GLOBAL.templates[file] = handlebars.compile(data)
        // resolve with template
        return template
    })
    // return promise
    return promise
}
142661
private T loadFileValue(final File file)
	{
		final boolean reload;

		// First time / first time with this file
		if (cached == null || lastFile == null || lastFileModified == null || !lastFile.equals(file))
		{
			lastFile = file;
			lastFileModified = file.lastModified();
			reload = true;
		}
		else // Same file, so check timestamp to decide on reload
		{
			final long modified = file.lastModified();

			reload = modified > lastFileModified;

			if (reload)
				lastFileModified = modified;
		}

		if (reload)
		{
			cached = null; // Prevent the old value from being used

			setCached(clazz.cast(factory.getInstance(clazz).deserialise(file)));
		}

		return cached;
	}
804676
function setCachedTemplateTree( $keyData, $uri, $res, $templatePath, &$extraParameters, &$root )
    {
        $key = $this->cacheKey( $keyData, $res, $templatePath, $extraParameters );
        eZTemplateTreeCache::setCachedTree( $key, $uri, $res, $templatePath, $extraParameters, $root );
        eZTemplateTreeCache::storeCache( $key, $templatePath );
    }
1181043
public function load($data_folder = '')
  {
    $this->templates_path = $data_folder . '/templates';

    $files = $this->read_dir($this->templates_path);

    $pattern = '/^(\w+).phtml$/';

    foreach($files as $file) {
      if (preg_match($pattern, $file, $match)) {
        $this->templates[$match[1]] = $file;
      }
    }
  }
65827
static function load(Smarty_Internal_Template $_template)
    {
        $_template->cached = new Smarty_Template_Cached($_template);
        $_template->cached->handler->populate($_template->cached, $_template);
        // caching enabled ?
        if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT ||
                $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || $_template->source->handler->recompiled
        ) {
            $_template->cached->valid = false;
        }
        return $_template->cached;
    }
868470
function do_load(file, name) {
		var name = name || file;
		if(!file) throw new Error("file not defined");
		var c = do_compile(file, name);
		dust.loadSource(c);
		if(_debug) console.log("[dustfs] [" + name + "] Template loaded: " + file);
		return c;
	}
266955
public function loadFile( $file ) {

		if ( empty( $this->files ) )
			$this->files = $this->readDirRecursive(
				$this->base_dir,
				'*' . $this->extension
			);

		if ( ! in_array( $file, $this->files ) )
			return FALSE;

		require_once $file;

		return TRUE;
	}
176154
def load(self, name, skip='', skip_original='', default_template=None, layout=None):
        """"""
        filename = self.resolve_path(name, skip=skip, skip_original=skip_original,
                                     default_template=default_template)

        if not filename:
            raise ParseError("Can't find template %s." % name)

        with self.lock:
            if layout:
                _filename = filename + '$$' + layout
                mtime = os.path.getmtime(filename)
            else:
                mtime = None
                _filename = filename

            if self.cache:
                if not self.use_tmp:
                    #check current template file expiration
                    t = self.templates.get(_filename, mtime=mtime)
                    if t:
                        #check depends tempaltes expiration
                        check = self.check_expiration(t)
                        if not check:
                            return t
                else:
                    #get cached file from disk
                    pass
            t = self._create_template(name, filename, layout=layout)
            if self.cache:
                if not self.use_tmp:
                    self.templates.set(_filename, t, mtime)
                else:
                    #save cached file to disk
                    pass

            return t