CBitrixComponentTemplate Class

CBitrixComponentTemplate class is used as the wrapper for component template. Separate CBitrixComponentTemplate class instance is created for each connected component. This instance is active from the moment the template is initialized in the component to the moment when component finishes connecting.

To receive access to this class methods (after template is initialized), get a template object inside the component, via component method CBitrixComponent::GetTemplate:

$template = & $this->GetTemplate();
$templateFile = $template->GetFile();

Starting from version 15.5.1, external css files can be used without additional manipulations with code. It is sufficient to write the following in the template.php file:


Method Description Available from version
GetSiteTemplate Returns site template that contains component template.
GetName Returns a component template name.
GetFolder Returns template folder path relative to site root.
GetFile Returns template file path relative to site root.
getComponent Returns reference to a CBitrixComponent class instance. 15.5.10
addExternalCss Connects external css. 15.5.1
addExternalJs Connects external JS. 15.5.1

© «Bitrix24», 2001-2023