makehtml.php

В файле themes/[имя_темы]/appearance/makehtml.php осуществляется:
  • сборка html-файла темы
  • подключение ThemeBlocks и PageBlocks
  • определение устройства
  • возможность задавать различные html-файлы тем для разных кластеров и для главной страницы

<?php
//***********************
// Подключение определителя устройства
//***********************
    
$srvMob $this->srvFactory("UtilMobileDetect");
    
$version $srvMob->getVersion();

    
//$srvPageBlocks = $this->srvFactory("PageBlocks");
    //$pageblocks = $srvPageBlocks->getAllBlocksCurPage();
    //if($pageblocks["title"] != "") $this->theme_title = $pageblocks["title"];

    
if($version == "iphone"$forbidClassicCSSandJS $forbidJSCalendar true;
    if(
$version == "mobile"$forbidClassicCSSandJS $forbidJSCalendar $forbidJSAjax true;


//***********************
// Запуск VisualTheme
//***********************
    
include("themes/standartHeaderWithoutBody.php");

    if(
$this->srvIsInstalled('VisualTheme')) {
          
$service $this->srvFactory('VisualTheme');
        
$keyFile 'theme';

        
//***********************
        // специальные темы для кластеров (опц.)
        //***********************
/*        if(($this->page["tag"] == $this->config["root_page"]) && ($version == "desktop"))
            $keyFile = 'theme-main';

         $tag = explode('/', $this->page["tag"], 2);
          switch($tag[0]) {
            case 'Tags':
                $keyFile = 'themeTags';
                   break;
            case 'Вход':
                $keyFile = 'themeEnter';
                   break;
        } 
*/

        //***********************
        // Подключение шаблона
        //***********************
        
$sm $service->NewSmarty();
        
$sm->assign('content',$data);
        
$sm->assign('path'$this->GetPagePath());
        
$sm->assign('pathwithspaces'$service->GetPagePathWithSpaces());
        
//$isUser = $this->GetUser()?true:false;
        
$sm->assign('isUser'$this->GetUser()?true:false); 

        
$showGlobalMsg "";
        if (
$message
            
$showGlobalMsg "alert('".$message."');";
        
$sm->assign('showGlobalMsg'$showGlobalMsg);



        
//***********************
        // Подключение блоков (общих и постраничных)
        //***********************
        
if($this->srvIsInstalled('ThemeBlocks'))
            
$sm->assign('blocks'ThemeBlocks_AllBlocks($this));
            
//$sm->assign('elements', $this->ajxElementsAllRun());

        //$srvPageBlocks = $this->srvFactory('PageBlocks');
        //if($srvPageBlocks)
        //    $sm->assign('pageblock', $srvPageBlocks->getAllBlocksCurPage());
 


        //**********************************************

        //echo $sm->fetch($keyFile.'-iphone.htm');
        //echo $sm->fetch($keyFile.'-'.$version.'.htm');
        
echo $sm->fetch($keyFile.'.htm');
    } else 
        echo 
'error: VisualTheme is not installed';
?>