本文整理汇总了PHP中CIBlock::replaceDetailUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::replaceDetailUrl方法的具体用法?PHP CIBlock::replaceDetailUrl怎么用?PHP CIBlock::replaceDetailUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::replaceDetailUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
"CampaignID" => $campaign["SETTINGS"]["CampaignID"],
"Title" => "",
"Text" => "",
"Href" => 'http'.($request->isHttps() ? 's' : '').'://'.$request->getHttpHost(),
"Geo" => Main\Config\Option::get('seo', 'yandex_direct_region_last_list', ''),
"Phrases" => array(),
"MinusKeywords" => array(),
)
);
if($elementId > 0 && Main\Loader::includeModule('iblock'))
{
$dbElement = \CIBlockElement::getByID($elementId);
if($element = $dbElement->fetch())
{
$banner['SETTINGS']['Href'] .= \CIBlock::replaceDetailUrl($element['DETAIL_PAGE_URL'], $element, false, "E");
}
}
else
{
$banner['SETTINGS']['Href'] .= '/';
}
$banner['SETTINGS']['Href'] .= strpos($banner['SETTINGS']['Href'], "?") >= 0 ? '?' : '&';
$banner['SETTINGS']['Href'] .= AdvSession::URL_PARAM_CAMPAIGN.'='.AdvSession::URL_PARAM_CAMPAIGN_VALUE.'&'.AdvSession::URL_PARAM_BANNER.'='.AdvSession::URL_PARAM_BANNER_VALUE;
}
$banner["SETTINGS"]["Geo"] = explode(",", $banner["SETTINGS"]["Geo"]);
$banner["SETTINGS"]["MinusKeywords"] = implode(", ", $banner["SETTINGS"]["MinusKeywords"]);
示例2: actionAdd
protected static function actionAdd($name, $arFields)
{
if ($name == 'ADDELEMENT') {
if (!self::checkElement($arFields)) {
return;
}
// we don't have the GLOBAL_ACTIVE flag in $arFields so we should check it manually
if (is_array($arFields['IBLOCK_SECTION']) && count($arFields['IBLOCK_SECTION']) > 0) {
$arNewSections = array();
$arFilter = array('ID' => $arFields['IBLOCK_SECTION'], 'IBLOCK_ID' => $arFields['IBLOCK_ID'], 'GLOBAL_ACTIVE' => 'Y');
$dbRes = \CIBlockSection::getList(array(), $arFilter, false, array('ID'));
while ($ar = $dbRes->fetch()) {
$arNewSections[] = $ar['ID'];
}
if (count($arNewSections) <= 0) {
// element is added to inactive sections
return;
}
$arFields['IBLOCK_SECTION'] = $arNewSections;
}
} elseif ($name == 'ADDSECTION') {
$dbRes = \CIBlockSection::getList(array(), array('ID' => $arFields['ID'], 'GLOBAL_ACTIVE' => 'Y'), false, array('ID'));
if (!$dbRes->fetch()) {
// section is added to inactive branch
return;
}
}
$arSitemaps = SitemapIblockTable::getByIblock($arFields, $name == 'ADDSECTION' ? SitemapIblockTable::TYPE_SECTION : SitemapIblockTable::TYPE_ELEMENT);
$arFields['TIMESTAMP_X'] = ConvertTimeStamp(false, "FULL");
if (isset($arFields['IBLOCK_SECTION']) && is_array($arFields['IBLOCK_SECTION']) && count($arFields['IBLOCK_SECTION']) > 0) {
$arFields['IBLOCK_SECTION_ID'] = min($arFields['IBLOCK_SECTION']);
}
if (count($arSitemaps) > 0) {
$arSiteDirs = array();
$dbSite = SiteTable::getList(array('select' => array('LID', 'DIR')));
while ($arSite = $dbSite->fetch()) {
$arSiteDirs[$arSite['LID']] = $arSite['DIR'];
}
foreach ($arSitemaps as $arSitemap) {
$arFields['LANG_DIR'] = $arSiteDirs[$arSitemap['SITE_ID']];
$rule = array('url' => $name == 'ADDSECTION' ? \CIBlock::replaceDetailUrl($arSitemaps[0]['SECTION_PAGE_URL'], $arFields, false, "S") : \CIBlock::replaceDetailUrl($arSitemaps[0]['DETAIL_PAGE_URL'], $arFields, false, "E"), 'lastmod' => MakeTimeStamp($arFields['TIMESTAMP_X']));
$fileName = str_replace(array('#IBLOCK_ID#', '#IBLOCK_CODE#', '#IBLOCK_XML_ID#'), array($arFields['IBLOCK_ID'], $arSitemap['IBLOCK_CODE'], $arSitemap['IBLOCK_XML_ID']), $arSitemap['SITEMAP_FILE_IBLOCK']);
$sitemapFile = new SitemapFile($fileName, $arSitemap);
$sitemapFile->appendIblockEntry($rule['url'], $rule['lastmod']);
$sitemapIndex = new SitemapIndex($arSitemap['SITEMAP_FILE'], $arSitemap);
$sitemapIndex->appendIndexEntry($sitemapFile);
if ($arSitemap['ROBOTS'] == 'Y') {
$robotsFile = new RobotsFile($arSitemap['SITE_ID']);
$robotsFile->addRule(array(RobotsFile::SITEMAP_RULE, $sitemapIndex->getUrl()));
}
}
}
}