예제 #1
0
 /**
  * @param CBitrixComponent $component
  * @param bool|string $siteTemplate
  * @param string $customTemplatePath
  * @return bool
  */
 function Init(&$component, $siteTemplate = false, $customTemplatePath = "")
 {
     global $arBXRuntimeTemplateEngines;
     $this->__bInited = false;
     if ($siteTemplate === false) {
         $this->__siteTemplate = $component->getSiteTemplateId();
     } else {
         $this->__siteTemplate = $siteTemplate;
     }
     if (strlen($this->__siteTemplate) <= 0) {
         $this->__siteTemplate = ".default";
     }
     $this->__file = "";
     $this->__fileAlt = "";
     $this->__folder = "";
     if (!$arBXRuntimeTemplateEngines) {
         $this->InitTemplateEngines();
     }
     if (!$component instanceof cbitrixcomponent) {
         return false;
     }
     $this->__component =& $component;
     $this->__name = $this->__component->GetTemplateName();
     if (strlen($this->__name) <= 0) {
         $this->__name = ".default";
     }
     $this->__name = preg_replace("'[\\\\/]+'", "/", $this->__name);
     $this->__name = trim($this->__name, "/");
     if (!$this->CheckName($this->__name)) {
         $this->__name = ".default";
     }
     $this->__page = $this->__component->GetTemplatePage();
     if (strlen($this->__page) <= 0) {
         $this->__page = "template";
     }
     if (!$this->__SearchTemplate($customTemplatePath)) {
         return false;
     }
     $this->__GetTemplateEngine();
     $this->__bInited = true;
     return true;
 }