本文整理汇总了PHP中CIBlock::ReplaceSectionUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::ReplaceSectionUrl方法的具体用法?PHP CIBlock::ReplaceSectionUrl怎么用?PHP CIBlock::ReplaceSectionUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::ReplaceSectionUrl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetNext
function GetNext($bTextHtmlAuto = true, $use_tilda = true)
{
static $arSectionPathCache = array();
$res = parent::GetNext($bTextHtmlAuto, $use_tilda);
if ($res) {
//Handle List URL for Element, Section or IBlock
if ($this->strListUrl) {
$TEMPLATE = $this->strListUrl;
} elseif (array_key_exists("~LIST_PAGE_URL", $res)) {
$TEMPLATE = $res["~LIST_PAGE_URL"];
} elseif (!$use_tilda && array_key_exists("LIST_PAGE_URL", $res)) {
$TEMPLATE = $res["LIST_PAGE_URL"];
} else {
$TEMPLATE = "";
}
if ($TEMPLATE) {
$res_tmp = $res;
if (intval($res["IBLOCK_ID"]) <= 0 && intval($res["ID"]) > 0) {
$res_tmp["IBLOCK_ID"] = $res["ID"];
$res_tmp["IBLOCK_CODE"] = $res["CODE"];
$res_tmp["IBLOCK_EXTERNAL_ID"] = $res["EXTERNAL_ID"];
if ($use_tilda) {
$res_tmp["~IBLOCK_ID"] = $res["~ID"];
$res_tmp["~IBLOCK_CODE"] = $res["~CODE"];
$res_tmp["~IBLOCK_EXTERNAL_ID"] = $res["~EXTERNAL_ID"];
}
}
if ($use_tilda) {
$res["~LIST_PAGE_URL"] = CIBlock::ReplaceDetailUrl($TEMPLATE, $res_tmp, true, false);
$res["LIST_PAGE_URL"] = htmlspecialcharsbx($res["~LIST_PAGE_URL"]);
} else {
$res["LIST_PAGE_URL"] = CIBlock::ReplaceDetailUrl($TEMPLATE, $res_tmp, true, false);
}
}
//If this is Element or Section then process it's detail and section URLs
if (strlen($res["IBLOCK_ID"])) {
if (array_key_exists("GLOBAL_ACTIVE", $res)) {
$type = "S";
} else {
$type = "E";
}
if ($this->strDetailUrl) {
$TEMPLATE = $this->strDetailUrl;
} elseif (array_key_exists("~DETAIL_PAGE_URL", $res)) {
$TEMPLATE = $res["~DETAIL_PAGE_URL"];
} elseif (!$use_tilda && array_key_exists("DETAIL_PAGE_URL", $res)) {
$TEMPLATE = $res["DETAIL_PAGE_URL"];
} else {
$TEMPLATE = "";
}
if ($TEMPLATE) {
if ($this->arSectionContext) {
$TEMPLATE = str_replace("#SECTION_ID#", $this->arSectionContext["ID"], $TEMPLATE);
$TEMPLATE = str_replace("#SECTION_CODE#", $this->arSectionContext["CODE"], $TEMPLATE);
if ($this->arSectionContext["ID"] > 0 && $this->arSectionContext["IBLOCK_ID"] > 0 && strpos($TEMPLATE, "#SECTION_CODE_PATH#") !== false) {
if (!array_key_exists($this->arSectionContext["ID"], $arSectionPathCache)) {
$rs = CIBlockSection::GetNavChain($this->arSectionContext["IBLOCK_ID"], $this->arSectionContext["ID"], array("ID", "IBLOCK_SECTION_ID", "CODE"));
while ($a = $rs->Fetch()) {
$arSectionPathCache[$this->arSectionContext["ID"]] .= urlencode($a["CODE"]) . "/";
}
}
if (isset($arSectionPathCache[$this->arSectionContext["ID"]])) {
$SECTION_CODE_PATH = rtrim($arSectionPathCache[$this->arSectionContext["ID"]], "/");
} else {
$SECTION_CODE_PATH = "";
}
$TEMPLATE = str_replace("#SECTION_CODE_PATH#", $SECTION_CODE_PATH, $TEMPLATE);
}
}
if ($use_tilda) {
$res["~DETAIL_PAGE_URL"] = CIBlock::ReplaceDetailUrl($TEMPLATE, $res, true, $type);
$res["DETAIL_PAGE_URL"] = htmlspecialcharsbx($res["~DETAIL_PAGE_URL"]);
} else {
$res["DETAIL_PAGE_URL"] = CIBlock::ReplaceDetailUrl($TEMPLATE, $res, true, $type);
}
}
if ($this->strSectionUrl) {
$TEMPLATE = $this->strSectionUrl;
} elseif (array_key_exists("~SECTION_PAGE_URL", $res)) {
$TEMPLATE = $res["~SECTION_PAGE_URL"];
} elseif (!$use_tilda && array_key_exists("SECTION_PAGE_URL", $res)) {
$TEMPLATE = $res["SECTION_PAGE_URL"];
} else {
$TEMPLATE = "";
}
if ($TEMPLATE) {
if ($use_tilda) {
$res["~SECTION_PAGE_URL"] = CIBlock::ReplaceSectionUrl($TEMPLATE, $res, true, $type);
$res["SECTION_PAGE_URL"] = htmlspecialcharsbx($res["~SECTION_PAGE_URL"]);
} else {
$res["SECTION_PAGE_URL"] = CIBlock::ReplaceSectionUrl($TEMPLATE, $res, true, $type);
}
}
}
}
return $res;
}