Skip to content

Instantly share code, notes, and snippets.

View dtsvetkovspb's full-sized avatar

Dmitry dtsvetkovspb

  • Russia, Saint-Petersburg
View GitHub Profile
@dtsvetkovspb
dtsvetkovspb / gist:74c6c6e7630e6eef5ed00f91de75e8c3
Created February 21, 2020 09:22
сортировка элементов section.list или news.list по пользовательскому свойству (тип список, в котором вручную проставлена сортировка)
"ELEMENT_SORT_FIELD" => 'propertysort_UF_CATEGORY',
"ELEMENT_SORT_ORDER" => 'asc',
$endDate = $arItem["ACTIVE_TO"];
$now = ConvertTimeStamp(time(),"FULL");
$isPromoEnd = (strtotime($endDate) < strtotime($now)); // проверяем что акция закончилась
if ($isPromoEnd) {
123
}
.class::after {
content: "";
position: absolute;
width: 0;
height: 0;
right: 15px;
top: 12px;
border-style: solid;
border-width: 4px 4px 0 4px;
border-color: #00aecd transparent transparent transparent;
$arFilter = array("IBLOCK_ID" => 44, "ACTIVE" => "Y", "ID" => 10022);
$arSelect = Array("ID", "IBLOCK_ID", "NAME", "DATE_ACTIVE_FROM","PROPERTY_*");
$res = CIBlockElement::GetList(array(), $arFilter, false, array(), $arSelect);
$arProps = [];
$arFields = [];
while($ob = $res->GetNextElement())
{
$arFields = $ob->GetFields();
$arProps = $ob->GetProperties();
}
$abc = get_object_vars($arResult['NAV_RESULT']);
echo '<pre>',print_r($abc['NavPageNomer'],1),'</pre>';
AddEventHandler('main', 'OnEpilog', '_Check404Error', 1);
function _Check404Error(){
if(defined('ERROR_404') && ERROR_404=='Y' || CHTTP::GetLastStatus() == "404 Not Found"){
GLOBAL $APPLICATION;
$APPLICATION->RestartBuffer();
require $_SERVER['DOCUMENT_ROOT'].SITE_TEMPLATE_PATH.'/header.php';
require $_SERVER['DOCUMENT_ROOT'].'/404.php';
require $_SERVER['DOCUMENT_ROOT'].SITE_TEMPLATE_PATH.'/footer.php';
}
}
<script>
var coordinates; // json объект со всеми данными карты
var varNames; // массив с именами объектов
$(document).ready(function() {
$.ajax({
url:'/local/templates/fsk/components/bitrix/catalog/.default/json.php', // берем из файла пхп файла в котором обработчик "echo file_get_contents('coordinates.json');"
type: 'POST',
dataType: 'json',
<?php foreach($mapLabels as $index => $label) : ?>
<?php if ($index === 0) :?>
<div class="cols col-1-3">
<?php endif; ?>
<div class="geo-label">
<span class="geo-label__ic" style="background: <?=$label['UF_DESCRIPTION']?>"> </span><?=$label['UF_NAME']?>
</div>
<?php if (($index+1) % 4 === 0) :?>
</div>
<?php endif;?>
@dtsvetkovspb
dtsvetkovspb / position center vertically absolute
Created October 24, 2019 09:24
position center vertically absolute
.element {
top: 50%;
transform: translateY(-50%);
}
@dtsvetkovspb
dtsvetkovspb / check window size js
Created October 23, 2019 14:43
check window size js
$(document).ready(function () {
resizewindow();
$(window).resize(function(e){
resizewindow();
});
function resizewindow() {
if(screen.width < 769) {
$(document).find('.progress').css('width', $(document).find('.right-wrapper').width() + 'px');
}
};