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');
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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