本文整理汇总了PHP中CComponentEngine::ParseComponentPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CComponentEngine::ParseComponentPath方法的具体用法?PHP CComponentEngine::ParseComponentPath怎么用?PHP CComponentEngine::ParseComponentPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComponentEngine
的用法示例。
在下文中一共展示了CComponentEngine::ParseComponentPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPage
/**
* Set type of the page
*/
protected function setPage()
{
$urlTemplates = [];
if ($this->arParams['SEF_MODE'] === 'Y') {
$variables = [];
$urlTemplates = \CComponentEngine::MakeComponentUrlTemplates($this->defaultUrlTemplates404, $this->arParams['SEF_URL_TEMPLATES']);
$variableAliases = \CComponentEngine::MakeComponentVariableAliases($this->defaultUrlTemplates404, $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->sefFolder = $this->arParams['SEF_FOLDER'];
$this->urlTemplates = $urlTemplates;
$this->variables = $variables;
$this->variableAliases = $variableAliases;
}
示例2: 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);
}
示例3: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
$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";
示例4: array
$rsSections = CIBlockSection::GetList($arOrder, $arFilter, false, array("ID", "DEPTH_LEVEL", "NAME", "SECTION_PAGE_URL"));
if ($arParams["IS_SEF"] !== "Y") {
$rsSections->SetUrlTemplates("", $arParams["SECTION_URL"]);
} else {
$rsSections->SetUrlTemplates("", $arParams["SEF_BASE_URL"] . $arParams["SECTION_PAGE_URL"]);
}
while ($arSection = $rsSections->GetNext()) {
$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") {
$componentPage = CComponentEngine::ParseComponentPath($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"];
}