PHP 클래스 Contao\TemplateLoader

The class stores template names and automatically loads the files upon their first usage. It uses a mapper array to support complex nesting and arbitrary subfolders to store the template files in. Usage: ClassLoader::addFile('moo_mediabox', 'core/templates');
파일 보기 프로젝트 열기: contao/core-bundle 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$files array Known files

공개 메소드들

메소드 설명
addFile ( string $name, string $file ) Add a new template with its file path
addFiles ( array $files ) Add multiple new templates with their file paths
getDefaultPath ( string $template, string $format ) : string Return the path to the default template
getFiles ( ) : array Return the template files as array
getPath ( string $template, string $format, string $custom = 'templates' ) : string Return a template path
getPrefixedFiles ( string $prefix ) : array Return the files matching a prefix as array
initialize ( ) Find the templates in the Contao resource folders.

메소드 상세

addFile() 공개 정적인 메소드

Add a new template with its file path
public static addFile ( string $name, string $file )
$name string The template name
$file string The path to the template folder

addFiles() 공개 정적인 메소드

Add multiple new templates with their file paths
public static addFiles ( array $files )
$files array An array of files

getDefaultPath() 공개 정적인 메소드

Return the path to the default template
public static getDefaultPath ( string $template, string $format ) : string
$template string The template name
$format string The output format (e.g. "html5")
리턴 string The path to the default template file

getFiles() 공개 정적인 메소드

Return the template files as array
public static getFiles ( ) : array
리턴 array An array of files

getPath() 공개 정적인 메소드

Return a template path
public static getPath ( string $template, string $format, string $custom = 'templates' ) : string
$template string The template name
$format string The output format (e.g. "html5")
$custom string The custom templates folder (defaults to "templates")
리턴 string The path to the template file

getPrefixedFiles() 공개 정적인 메소드

Return the files matching a prefix as array
public static getPrefixedFiles ( string $prefix ) : array
$prefix string The prefix (e.g. "moo_")
리턴 array An array of matching files

initialize() 공개 정적인 메소드

Find the templates in the Contao resource folders.
public static initialize ( )

프로퍼티 상세

$files 보호되어 있는 정적으로 프로퍼티

Known files
protected static array $files
리턴 array