当前位置: 首页>>代码示例>>PHP>>正文


PHP CComponentEngine::InitComponentVariables方法代码示例

本文整理汇总了PHP中CComponentEngine::InitComponentVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP CComponentEngine::InitComponentVariables方法的具体用法?PHP CComponentEngine::InitComponentVariables怎么用?PHP CComponentEngine::InitComponentVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CComponentEngine的用法示例。


在下文中一共展示了CComponentEngine::InitComponentVariables方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getResult

 /**
  * получение результатов
  */
 protected function getResult()
 {
     $urlTemplates = array();
     if ($this->arParams['SEF_MODE'] == 'Y') {
         $variables = array();
         $urlTemplates = \CComponentEngine::MakeComponentUrlTemplates($this->defaultUrlTemplates404, $this->arParams['SEF_URL_TEMPLATES']);
         $variableAliases = \CComponentEngine::MakeComponentVariableAliases($this->defaultUrlTemplates404, $this->arParams['VARIABLE_ALIASES']);
         $this->page = \CComponentEngine::ParseComponentPath($this->arParams['SEF_FOLDER'], $urlTemplates, $variables);
         if (strlen($this->page) <= 0) {
             $this->page = 'index';
         }
         \CComponentEngine::InitComponentVariables($this->page, $this->componentVariables, $variableAliases, $variables);
     } else {
         $this->page = 'index';
     }
     $this->arResult = array('FOLDER' => $this->arParams['SEF_FOLDER'], 'URL_TEMPLATES' => $urlTemplates, 'VARIABLES' => $variables, 'ALIASES' => $variableAliases);
 }
开发者ID:belukov,项目名称:bx-components,代码行数:20,代码来源:class.php

示例2: setPage

 /**
  * Set type of the page
  */
 protected function setPage()
 {
     $urlTemplates = array();
     if ($this->arParams['SEF_MODE'] === 'Y') {
         $variables = array();
         $urlTemplates = \CComponentEngine::MakeComponentUrlTemplates($this->defaultUrlTemplates, $this->arParams['SEF_URL_TEMPLATES']);
         $variableAliases = \CComponentEngine::MakeComponentVariableAliases($this->defaultUrlTemplates, $this->arParams['VARIABLE_ALIASES']);
         $this->templatePage = \CComponentEngine::ParseComponentPath($this->arParams['SEF_FOLDER'], $urlTemplates, $variables);
         if (!$this->templatePage) {
             if ($this->arParams['SET_404'] === 'Y') {
                 $folder404 = str_replace('\\', '/', $this->arParams['SEF_FOLDER']);
                 if ($folder404 != '/') {
                     $folder404 = '/' . trim($folder404, "/ \t\n\r\v") . "/";
                 }
                 if (substr($folder404, -1) == '/') {
                     $folder404 .= 'index.php';
                 }
                 if ($folder404 != Main\Context::getCurrent()->getRequest()->getRequestedPage()) {
                     $this->return404();
                 }
             }
             $this->templatePage = $this->defaultSefPage;
         }
         /* if ($this->isSearchRequest() && $this->arParams['USE_SEARCH'] === 'Y')
            {
                $this->templatePage = 'search';
            } */
         \CComponentEngine::InitComponentVariables($this->templatePage, $this->componentVariables, $variableAliases, $variables);
     } else {
         $this->templatePage = $this->defaultPage;
     }
     $this->arResult['FOLDER'] = $this->arParams['SEF_FOLDER'];
     $this->arResult['URL_TEMPLATES'] = $urlTemplates;
     $this->arResult['VARIABLES'] = $variables;
     $this->arResult['ALIASES'] = $variableAliases;
 }
开发者ID:adevelopers,项目名称:base,代码行数:39,代码来源:class.php

示例3: array

}
$arDefaultUrlTemplates404 = array("list" => "profile_list.php", "detail" => "profile_detail.php?ID=#ID#");
$arDefaultVariableAliases404 = array();
$arDefaultVariableAliases = array();
$arComponentVariables = array("ID", "del_id");
$componentPage = "";
$arVariables = array();
$this->setFramemode(false);
if ($arParams["SEF_MODE"] == "Y") {
    $arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams["SEF_URL_TEMPLATES"]);
    $arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]);
    $componentPage = CComponentEngine::ParseComponentPath($arParams["SEF_FOLDER"], $arUrlTemplates, $arVariables);
    CComponentEngine::InitComponentVariables($componentPage, $arComponentVariables, $arVariableAliases, $arVariables);
    foreach ($arUrlTemplates as $url => $value) {
        $arResult["PATH_TO_" . ToUpper($url)] = $arParams["SEF_FOLDER"] . $value;
    }
    if ($componentPage != "detail") {
        $componentPage = "list";
    }
    $arResult = array_merge(array("SEF_FOLDER" => $arParams["SEF_FOLDER"], "URL_TEMPLATES" => $arUrlTemplates, "VARIABLES" => $arVariables, "ALIASES" => $arVariableAliases), $arResult);
} else {
    $arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]);
    CComponentEngine::InitComponentVariables(false, $arComponentVariables, $arVariableAliases, $arVariables);
    if (IntVal($_REQUEST["ID"]) > 0) {
        $componentPage = "detail";
    } else {
        $componentPage = "list";
    }
    $arResult = array("VARIABLES" => $arVariables, "ALIASES" => $arVariableAliases);
}
$this->IncludeComponentTemplate($componentPage);
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:component.php

示例4: array

}
$arParams['USER_ID'] = $USER->GetID();
$arDefaultUrlTemplates404 = array("list" => "", "meeting" => "meeting/#MEETING_ID#/", "meeting_edit" => "meeting/#MEETING_ID#/edit/", "meeting_copy" => "meeting/#MEETING_ID#/copy/", "item" => "item/#ITEM_ID#/");
$arDefaultVariableAliases404 = array();
$arDefaultVariableAliases = array();
$arComponentVariables = array("MEETING_ID", "ITEM_ID", "edit", "COPY");
$componentPage = "";
$arVariables = array();
if ($arParams["SEF_MODE"] == "Y") {
    $arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams["SEF_URL_TEMPLATES"]);
    $arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]);
    $componentPage = CComponentEngine::ParseComponentPath($arParams["SEF_FOLDER"], $arUrlTemplates, $arVariables);
    if (!$componentPage) {
        $componentPage = "list";
    }
    CComponentEngine::InitComponentVariables($componentPage, $arComponentVariables, $arVariableAliases, $arVariables);
    $arResult = array("FOLDER" => $arParams["SEF_FOLDER"], "URL_TEMPLATES" => $arUrlTemplates, "VARIABLES" => $arVariables, "ALIASES" => $arVariableAliases);
}
if ($componentPage == 'meeting_edit') {
    $componentPage = 'meeting';
    $arParams['EDIT'] = 'Y';
} elseif ($componentPage == 'meeting_copy') {
    $componentPage = 'meeting';
    $arParams['COPY'] = 'Y';
}
switch ($componentPage) {
    case 'meeting':
        $arParams['MEETING_ID'] = $arVariables['MEETING_ID'];
        break;
    case 'item':
        $arParams['ITEM_ID'] = $arVariables['ITEM_ID'];
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例5: array

            $arResult["SECTIONS"][] = array("ID" => $arSection["ID"], "DEPTH_LEVEL" => $arSection["DEPTH_LEVEL"], "~NAME" => $arSection["~NAME"], "~SECTION_PAGE_URL" => $arSection["~SECTION_PAGE_URL"]);
            $arResult["ELEMENT_LINKS"][$arSection["ID"]] = array();
        }
        $this->EndResultCache();
    }
}
//In "SEF" mode we'll try to parse URL and get ELEMENT_ID from it
if ($arParams["IS_SEF"] === "Y") {
    $engine = new CComponentEngine($this);
    if (CModule::IncludeModule('iblock')) {
        $engine->addGreedyPart("#SECTION_CODE_PATH#");
        $engine->setResolveCallback(array("CIBlockFindTools", "resolveComponentEngine"));
    }
    $componentPage = $engine->guessComponentPath($arParams["SEF_BASE_URL"], array("section" => $arParams["SECTION_PAGE_URL"], "detail" => $arParams["DETAIL_PAGE_URL"]), $arVariables);
    if ($componentPage === "detail") {
        CComponentEngine::InitComponentVariables($componentPage, array("SECTION_ID", "ELEMENT_ID"), array("section" => array("SECTION_ID" => "SECTION_ID"), "detail" => array("SECTION_ID" => "SECTION_ID", "ELEMENT_ID" => "ELEMENT_ID")), $arVariables);
        $arParams["ID"] = intval($arVariables["ELEMENT_ID"]);
    }
}
if ($arParams["ID"] > 0 && intval($arVariables["SECTION_ID"]) <= 0 && CModule::IncludeModule("iblock")) {
    $arSelect = array("ID", "IBLOCK_ID", "DETAIL_PAGE_URL", "IBLOCK_SECTION_ID");
    $arFilter = array("ID" => $arParams["ID"], "ACTIVE" => "Y", "IBLOCK_ID" => $arParams["IBLOCK_ID"]);
    $rsElements = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
    if ($arParams["IS_SEF"] === "Y" && strlen($arParams["DETAIL_PAGE_URL"]) > 0) {
        $rsElements->SetUrlTemplates($arParams["SEF_BASE_URL"] . $arParams["DETAIL_PAGE_URL"]);
    }
    while ($arElement = $rsElements->GetNext()) {
        $arResult["ELEMENT_LINKS"][$arElement["IBLOCK_SECTION_ID"]][] = $arElement["~DETAIL_PAGE_URL"];
    }
}
$aMenuLinksNew = array();
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php

示例6: getSEF_Settings

 /**
  * Инициализирует ЧПУ из настроек компонента
  * @return bool
  */
 protected function getSEF_Settings()
 {
     if ($this->arParams['SEF_MODE'] == 'Y') {
         $engine = new \CComponentEngine($this);
         foreach ($this->arParams['GREEDY_PARTS'] as $part) {
             $engine->addGreedyPart($part);
         }
         $this->arUrlTemplates = \CComponentEngine::MakeComponentUrlTemplates(array(), $this->arParams["SEF_URL_TEMPLATES"]);
         $this->arVariableAliases = \CComponentEngine::MakeComponentVariableAliases(array(), $this->arParams["VARIABLE_ALIASES"]);
         $this->componentRoute = $engine->guessComponentPath($this->arParams["SEF_FOLDER"], $this->arUrlTemplates, $this->arVariables);
         $this->parseGreedyPartsVariables();
         if (!$this->componentRoute) {
             if (static::isPathsEqual($this->request->getRequestedPageDirectory(), $this->arParams["SEF_FOLDER"])) {
                 $this->genCallable(true);
                 return true;
             } else {
                 return false;
             }
         } else {
             \CComponentEngine::InitComponentVariables($this->componentRoute, $this->arComponentVariables, $this->arVariableAliases, $this->arVariables);
             //переставляем переменные в том порядке, к вотором они должны попасть в функцию
             $componentParameters = $this->getComponentParameters();
             if (isset($componentParameters['PARAMETERS']['SEF_MODE'][$this->componentRoute]['VARIABLES'])) {
                 $parametersVars = $componentParameters['PARAMETERS']['SEF_MODE'][$this->componentRoute]['VARIABLES'];
                 foreach ($parametersVars as $varName) {
                     if (isset($this->arVariables[$varName])) {
                         $this->componentRouteVariables[] = $this->arVariables[$varName];
                     } else {
                         $this->componentRouteVariables[] = null;
                     }
                 }
             }
             $this->genCallable();
             return true;
         }
     } else {
         $this->genCallable(true);
         return true;
     }
 }
开发者ID:digitalwand,项目名称:mvc.base,代码行数:44,代码来源:class.php


注:本文中的CComponentEngine::InitComponentVariables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。