This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
var btn = $('#set_filter_price'); | |
var myVar = setInterval(function(){ | |
checkBtnFilter(); | |
}, 50); | |
function checkBtnFilter() { | |
if(!btn.prop('disabled')){ | |
btn.click(); | |
//console.log(btn) |
This file contains hidden or 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 | |
/* | |
$cp = $this->__component; // объект компонента | |
if (is_object($cp)) { | |
$cp->arResult['NAV_RESULT'] = $arResult['NAV_RESULT']; | |
$cp->SetResultCacheKeys(Array('NAV_RESULT')); | |
} | |
*/ | |
This file contains hidden or 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 | |
/** | |
* Преобразование количества "цифрой" в количество "словом" | |
* Чтобы было удобнее формировать массивы со склонениями, запомните ряд чисел 1-2-5, | |
* а потом мысленно подставляйте их в массив: (один "рубль", два "рубля", пять "рублей") | |
* $num = 3; | |
* $words = array('новость', 'новости', 'новостей'); | |
* echo $num . ' ' . num2word($num, $words); // сколько новостей | |
* | |
* @param $n |
This file contains hidden or 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 hidden or 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
# Redirect from index.php to / | |
RewriteCond %{THE_REQUEST} index.php [NC] | |
RewriteCond %{REQUEST_URI} !/bitrix/admin/.* [NC] | |
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L] |
NewerOlder