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


PHP CIBlock::ReplaceSectionUrl方法代码示例

本文整理汇总了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;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:97,代码来源:iblockresult.php


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