Find a single template by its file name.

@param  string $fileName
@return mixed|static
338617
public function find($fileName)
    {
        $filePath = $this->getFilePath($fileName);

        if (!File::isFile($filePath)) {
            return null;
        }

        if (($content = @File::get($filePath)) === false) {
            return null;
        }

        $this->fileName = $fileName;
        $this->originalFileName = $fileName;
        $this->mtime = File::lastModified($filePath);
        $this->content = $content;
        $this->exists = true;
        return $this;
    }
1305014
public function getFilePath($filename)
    {
        if (modules()) {
            $filePaths = modules()->getDirs('Views');
        } else {
            $filePaths = array_reverse($this->filePaths);
        }

        foreach ($filePaths as $filePath) {
            if (is_file($filePath . $filename . '.phtml')) {
                return $filePath . $filename . '.phtml';
                break;
            } elseif (is_file($filePath . 'errors' . DIRECTORY_SEPARATOR . $filename . '.phtml')) {
                return $filePath . 'errors' . DIRECTORY_SEPARATOR . $filename . '.phtml';
                break;
            }
        }
    }
636708
public static function load( $fileName )
	{
		$parser	= new XML_DOM_Parser();
		$xml	= FS_File_Reader::load( $fileName );
		$tree	= $parser->parse( $xml );
		return $tree;
	}
1259034
public function findFirstOccurenceOfFile(string $fileName)
    {
        if (!$this->isDir() || !$this->exists()) {
            return null;
        }

        foreach ($this->scanDir() as $file) {
            if ($file->getFileName() === $fileName) {
                return $file;
            }

            if ($file->isDir()) {
                $result = $file->findFirstOccurenceOfFile($fileName);
                if ($result !== null) {
                    return $result;
                }
            }
        }
        return null;
    }
26959
public function findPath($filename)
    {
        if (!isset($this->_paths[$filename])) {
            foreach ($this->_search_paths as $path) {
                $file = $path.'/'.$filename;
                if ($this->findFile($file)) {
                    $this->_paths[$filename] = $file;
                    return $file;
                }
            }

            $this->_paths[$filename] = false;
        }

        return $this->_paths[$filename];
    }
1070372
public static function find($filename)
    {
        // Split to folders and the actual filename, and traverse the structure.
        $parts = array_filter(preg_split("#[/\\\\]+#", $filename));
        $parentID = 0;
        /** @var File $item */
        $item = null;
        foreach ($parts as $part) {
            $item = File::get()->filter(array(
                'Name' => $part,
                'ParentID' => $parentID
            ))->first();
            if (!$item) {
                break;
            }
            $parentID = $item->ID;
        }

        return $item;
    }
1276540
public function getFilePath($filename)
    {
        if (!strpos($filename, '.')) {
            $filename .= ".phtml";
        }

        foreach ($this->config->getPaths() as $path) {
            $file = "$path/$filename";

            if (file_exists($file)) {
                return $file;
            }
        }

        throw new FileNotFoundException(
            'File \'' . $filename . '\' was not found.'
        );
    }
1346109
public function getFile($fileName)
    {
        $result = false;

        if (isset($_FILES[$fileName])) {
            $result = $_FILES[$fileName];
        }

        return $result;
    }
1225858
public static function loadFromFile($filename)
	{
		$xmlFile = substr($filename, 0, -4) . '/plugin.xml';
		if (file_exists($xmlFile))
		{
			return self::loadFromXmlFile($xmlFile);
		}
		else
		{
			return self::loadFromPhpFile($filename);
		}
	}
989793
protected function find($fileName)
    {
        $fileName = $fileName . '.' . $this->fileExtension;

        foreach ($this->viewPaths as $path) {
            if (file_exists($path . $fileName)) {
                return realpath($path . $fileName);
            }
        }

        throw new \Exception("View $fileName not found.");
    }
129911
public function getFileContents($filename)
    {
        if ($contents = file_get_contents($filename)) {
            if (preg_match('/<body ?.*?>(.+)<\/body>/s', $contents, $matches)) {
                return $matches[1];
            } else { // it's not HTML, so output it as plain text
                return $contents;
            }
        }
        return FALSE;
    }
987567
public function loadTemplate($strFilename) {
        if(file_exists($strFilename)) {
            $template = new PHPWord_Template($strFilename);
            return $template;
        } else {
            trigger_error('Template file '.$strFilename.' not found.', E_ERROR);
        }
    }
842289
public function getView($filename, $data = null)
    {
        // $data = ($data === null) ? $this->_data : $data;
        return $this->getTemplateFile($this->getTemplateFolder().$filename, $data);
    }
132343
public function getFile($filename)
    {
        $filename = $this->outDir.DIRECTORY_SEPARATOR.$filename;
        $this->mkdir(dirname($filename));
        if (is_file($filename) && $this->backup) {
            @rename($filename, sprintf('%s.bak', $filename));
        }

        return $filename;
    }
326582
public function getHash($fileName)
    {
        if (array_key_exists($fileName, $this->data)) {
            return $this->data[$fileName];
        } else if (array_key_exists($this->_makeRelative($fileName), $this->data)) {
            return $this->data[$this->_makeRelative($fileName)];
        } else {
            return null;
        }
    }
572106
public static function check($filename)
    {
        if (!$filename = static::path($filename)) {
            return null;
        }

        if (!file_exists($filename)) {
            return null;
        }

        return filemtime($filename);
    }
835893
public function getTemplateFile($filename, $data)
    {
        $data['getRegion'] = function($name) { 
            return $this->getRegion($name); 
            }; // This is for mustache compatibility

        // Push the data into regions and then pass a pointer to this class to the layout
        // $this->setRegions($data);
        return parent::getTemplateFile($filename, $data); // Pass in layout object to template
    }