Documentation

addByTemplate

addByTemplate

public function Landing::addByTemplate(
   $siteId,
   $fields,
   $code
);

Adding a landing page by template

Parameters

Parameter Description Available from version
siteId ID of the site to create a page.
code ID for the created template. Parameter can be defined as shown in example with connected component.
fields Optional. Can pass an array with fields for created page. Presently, supports only the key TITLE и DESCRIPTION.

Example

if (\Bitrix\Main\Loader::includeModule('landing'))
{
   $res = \Bitrix\Landing\Landing::addByTemplate(1, 'app', 
      [
         'TITLE' => 'New page',
         'DESCRIPTION' => 'New page description'
      ]
   );
   if ($res->isSuccess())
   {
      echo 'new id: ' . $res->getId();
   }
   else
   {
      print_r($res->getErrors());
   }
}


© «Bitrix24», 2001-2024
Up