PHP Класс Newscoop\Services\TemplatesService

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$originalVector
$publicationService PublicationService Publication Service
$smarty CampTemplate
$themesService ThemesServiceInterface Themes Service

Открытые методы

Метод Описание
__construct ( ThemesService $themesService, PublicationService $publicationService )
fetchTemplate ( string $file, array $params = [], integer $lifetime = 1400 ) : string Fetch template with smarty
getSmarty ( ) : Smarty Get current smarty object
renderTemplate ( string $file, array $params = [], integer $lifetime = 1400, boolean $render = true ) : string Render template with smarty (will echo outupt)
setLifetime ( integer $lifetime ) Set template cache lifetime
setVector ( array $vector ) Newscoop caching save cached template file content with special vector parameters.

Приватные методы

Метод Описание
assignParameters ( $params = [] )
preconfigureSmarty ( )
preconfigureVector ( )

Описание методов

__construct() публичный метод

public __construct ( ThemesService $themesService, PublicationService $publicationService )
$themesService ThemesService
$publicationService PublicationService

fetchTemplate() публичный метод

Fetch template with smarty
public fetchTemplate ( string $file, array $params = [], integer $lifetime = 1400 ) : string
$file string template file path
$params array array with template parameters
$lifetime integer template cache lifetime (default: 1400 seconds)
Результат string Template output

getSmarty() публичный метод

Get current smarty object
public getSmarty ( ) : Smarty
Результат Smarty

renderTemplate() публичный метод

Render template with smarty (will echo outupt)
public renderTemplate ( string $file, array $params = [], integer $lifetime = 1400, boolean $render = true ) : string
$file string template file path
$params array array with template parameters
$lifetime integer template cache lifetime (default: 1400 seconds)
$render boolean render or just fetch template (default: true [render])
Результат string Template output

setLifetime() публичный метод

Set template cache lifetime
public setLifetime ( integer $lifetime )
$lifetime integer

setVector() публичный метод

By default vector is filled with 6 parameters: * (int) language * (int) publication * (int) issue * (int) section * (int) article * (string) params In this service vector is allways prefilled only with publication and language values. You need to set manualny (if needed) issue, section, article or params keys
public setVector ( array $vector )
$vector array

Описание свойств

$originalVector защищенное свойство

protected $originalVector

$publicationService защищенное свойство

Publication Service
protected PublicationService,Newscoop\Services $publicationService
Результат PublicationService

$smarty защищенное свойство

protected CampTemplate $smarty
Результат CampTemplate

$themesService защищенное свойство

Themes Service
protected ThemesServiceInterface $themesService
Результат ThemesServiceInterface