Documentation

InitComponentTemplate

bool
InitComponentTemplate([
 string templatePage,
 siteTemplate = false,
 customTemplatePath = ""]
);

The method initializes component template. After this method is called, a template object can be retrieved via the method CBitrixComponent::GetTemplate. In this case, template component is connected by the method CBitrixComponent::ShowComponentTemplate. Non-static method.

If the template object is not required for the component code, use one method CBitrixComponent::IncludeComponentTemplate which both initialises and connects a template.

Parameters

ParameterDescription Available from version
templatePage Component template page name. Installed for complex components. For normal components, this parameter be empty or not specified.
siteTemplate
customTemplatePath 10.0.5

Returned value

Returns True on successful initialization, returns False otherwise.

Example

if ($this->InitComponentTemplate($templatePage))
{
	$template = & $this->GetTemplate();
	$folderPath = $template->GetFolder();
	if (strlen($folderPath) > 0)
	{
		* * *
	}
	$this->ShowComponentTemplate();
}

See Also

  • CBitrixComponent::ShowComponentTemplate
  • CBitrixComponent::GetTemplate
  • CBitrixComponent::IncludeComponentTemplate


  • © «Bitrix24», 2001-2024
    Up