protected function locateTemplateFilePath($filename)
    {
        // Search project root template directory if defined.
        if ($this->hasProjectTemplateDirectory()) {
            $filepath = $this->templateProjectPath() . "/{$filename}";

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

        // Search defined directories for template files.
        foreach ($this->searchDirectories as $directory) {
            if (!file_exists($directory)) {
                continue;
            }
            $filepath = "{$directory}/{$filename}";

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

        return null;
    }
protected function locateTemplateFilePath($filename)
    {
        // Search project root template directory if defined.
        if ($this->hasProjectTemplateDirectory()) {
            $filepath = $this->templateProjectPath() . "/{$filename}";

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

        // Search defined directories for template files.
        foreach ($this->searchDirectories as $directory) {
            if (!file_exists($directory)) {
                continue;
            }
            $filepath = "{$directory}/{$filename}";

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

        return null;
    }
protected function locateTemplateFilePath ( $ filename ) { // Search project root template directory if defined. if ( $ this -> hasProjectTemplateDirectory ( ) ) { $ filepath = $ this -> templateProjectPath ( ) . "/{$filename}" ; if ( file_exists ( $ filepath ) ) { return $ filepath ; } } // Search defined directories for template files. foreach ( $ this -> searchDirectories as $ directory ) { if ( ! file_exists ( $ directory ) ) { continue ; } $ filepath = "{$directory}/{$filename}" ; if ( file_exists ( $ filepath ) ) { return $ filepath ; } } return null ; }
Locate the template file path.

It checks different template directories for a specific filename to see
if the template file was overridden before returning the default.

@param string $filename
The name of the template file.

@return string
The path to the template file.
Locate the template file path .