Example #1
0
<?

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true)
	die();
if (CModule::IncludeModuleEx('prmedia.treelikecomments') != MODULE_DEMO_EXPIRED)
{

	if ($this->StartResultCache($arParams['CACHE_TIME']))
	{
		CModule::IncludeModule("prmedia.treelikecomments");
		CModule::IncludeModule("iblock");

		$arResult['TITLE'] = $arParams['TITLE'];

		$res = CTreelikeComments::getPopularElements($arParams['COUNT']);
		while ($arRes = $res->GetNext())
		{
			$element = CIBlockElement::GetByID($arRes['OBJECT_ID']);
			if ($arElement = $element->GetNext())
			{

				$detailURL = $arParams['DETAIL_PAGE_URL'];
				if (preg_match('/ID/i', $detailURL))
					$detailURL = str_replace('#ID#', $arElement['ID'], $detailURL);
				if (preg_match('/CODE/i', $detailURL))
					$detailURL = str_replace('#CODE#', $arElement['CODE'], $detailURL);
				if (preg_match('/DETAIL_PAGE_URL/i', $detailURL))
					$detailURL = str_replace('#DETAIL_PAGE_URL#', $arElement['DETAIL_PAGE_URL'], $detailURL);
				if (preg_match('/SECTION_ID/i', $detailURL))
					$detailURL = str_replace('#SECTION_ID#', $arElement['IBLOCK_SECTION_ID'], $detailURL);
				if (preg_match('/SECTION_CODE/i', $detailURL))