Documentation

addByTemplate

public function Site::addByTemplate(
   $code,
   $type
);

Adds site by template.

8217703#add_by_template

Developer executes code within a specific template context. However, if you want to print the list of available templates, view it here.

Parameters

Method Description Available from version
code Template ID for creating. Parameter can be defined as shown in the example with connecting of component.
$type Site type.

Example

if (\Bitrix\Main\Loader::includeModule('landing'))
{
   $res = \Bitrix\Landing\Site::addByTemplate('app', 'STORE');
   if ($res->isSuccess())
   {
      echo 'Success created';
   }
}


© «Bitrix24», 2001-2024