This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bitrix\Main\Diag; | |
$connection = Bitrix\Main\Application::getConnection(); | |
/** Bitrix\Main\Diag\SqlTracker $tracker */ | |
$tracker = $connection->startTracker(); | |
// ... | |
$connection->stopTracker(); | |
foreach ($tracker->getQueries() as $query) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$bx_photo = CIBlockElement::GetProperty( | |
$IBID, | |
$id, | |
'sort', | |
'asc', | |
array('CODE' => 'PHOTO') | |
); | |
$ar_photo = $bx_photo->Fetch(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Правило обрабатывает внутренние страницы | |
# http://site.ru/catalog////item/// | |
RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$ | |
#Проверяем, повторяется ли слеш (//) более двух раз. | |
RewriteRule . %1/%2 [R=301,L] | |
#Исключаем все лишние слеши. | |
#удаляем слеши для главной http://site.ru///// | |
RewriteCond %{THE_REQUEST} ([^\s]*)\/{2,}(\?[^\s]*)? | |
RewriteRule (.*) / [R=301,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
use \Bitrix\Main\Data\Cache; | |
//<ПРостий кеш> | |
$cache = Cache::createInstance(); // отрматике ексзепляр класу | |
if ($cache->initCache(7200, "cache_key")) { | |
$vars = $cache->getVars(); // отримани змінні з кешу | |
} | |
elseif ($cache->startDataCache()) { | |
// некоторые действия... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(!CModule::IncludeModule('highloadblock')) die(); | |
use Bitrix\Highloadblock as HL; | |
use Bitrix\Main\Entity; | |
$hlblock = HL\HighloadBlockTable::getById(5)->fetch(); | |
$hlEntity = HL\HighloadBlockTable::compileEntity($hlblock); | |
$entDataClass = $hlEntity->getDataClass(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Найдем пользователей с пустым guid с регистрацией не больше месяца | |
$objDateTime = new \Bitrix\Main\Type\DateTime(); | |
$objDateTime->add("-1 months"); | |
$arFilter = Array( | |
"UF_GUID"=>'', | |
">DATE_REGISTER"=> $objDateTime, | |
"LOGIN" =>"+%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$APPLICATION->ShowViewContent('type_order'); | |
$this->SetViewTarget("type_order"); | |
echo $type_order; | |
$this->EndViewTarget(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Очистка кеша | |
* @param array $iblockIds - id инфоблоков | |
*/ | |
function ClearCache($iblockIds = array()) | |
{ | |
CModule::IncludeModule('iblock'); | |
// >= iblock 15.0.7 | |
if (method_exists('CIBlock', 'clearIblockTagCache')) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Получить свойство элемента | |
$rProp = CIBlockElement::GetProperty($iblock_id, $element_id, "sort", "asc", array("CODE" => "badge")); | |
$badge = ($aProp = $rProp->GetNext())? $aProp['VALUE'] :''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bitrix\Main\Loader; | |
if(!Loader::includeModule("iblock")) die(); | |
$aFilter = array("IBLOCK_ID"=>25, "ACTIVE"=>"Y"); | |
$rPart = CIBlockElement::GetList(array('sort'=>'ASC'), $aFilter, false, false, array()); | |
while($oPart = $rPart->GetNextElement()): | |
$aPart = $oPart->GetFields(); | |
$aPart['PROP'] = $oPart->GetProperties(); |
NewerOlder