Skip to content

Instantly share code, notes, and snippets.

@Elvinz
Elvinz / simple_create_section.php
Created February 4, 2018 17:18 — forked from helloris25/simple_create_section.php
Быстрое создание секций битриксе
<?php
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetPageProperty("NOT_SHOW_NAV_CHAIN", "Y");
$APPLICATION->SetTitle("Импорт секций инфоблока");
if(CModule::IncludeModule("iblock")) {
$arIBlocks = [];
$rsIBlocks = CIBlock::GetList(["sort" => "asc"], ["ACTIVE" => "Y"]);
while($arIBlock = $rsIBlocks->Fetch())
{
@Elvinz
Elvinz / untitled
Created February 7, 2018 09:34 — forked from andy-kliman/untitled
Edit Shortcuts в кастомайзере
add_action('customize_register', 'dco_customize_register');
function dco_customize_register($wp_customize) {
//FOOTER
$wp_customize->add_section('footer', array(
'title' => 'Подвал',
'priority' => 1,
));
//footer text
@Elvinz
Elvinz / functions.php
Created February 7, 2018 09:36 — forked from srikat/functions.php
How to use Customizer API to add settings for Header background color and background image in Genesis. https://sridharkatakam.com/how-to-use-customizer-api-to-add-settings-for-header-background-color-and-background-image-in-genesis/
/**
* HEX Color sanitization callback.
*
* - Sanitization: hex_color
* - Control: text, WP_Customize_Color_Control
*
* Note: sanitize_hex_color_no_hash() can also be used here, depending on whether
* or not the hash prefix should be stored/retrieved with the hex color value.
*
* @see sanitize_hex_color() https://developer.wordpress.org/reference/functions/sanitize_hex_color/
@Elvinz
Elvinz / dep.php
Created June 26, 2019 05:09 — forked from iredun/dep.php
Получить список разделов и их подразделов в 1С - Битрикс
<?
$res = CIBlockSection::GetList(
Array('name' => 'asc'),
Array('IBLOCK_ID' =>'5' , 'ACTIVE' => 'Y')
);
while ($row = $res->GetNext())
{
echo $row['NAME'].'<br>';
$rsParentSection = CIBlockSection::GetByID($row['ID']);
if ($arParentSection = $rsParentSection->GetNext())
@Elvinz
Elvinz / gist:5d5047d2777c290241925a4814905631
Created November 16, 2019 17:20 — forked from morsvox/gist:5e587a3290f3c226d638
validation js + bitrix + ajax
$('form[name="faq-ui-dialog"] input[type="submit"]').click(function(){
var Error = false,
ErrorList = '';
Captcha = $('form[name="faq-ui-dialog"] input[name="captcha_word"]').val();
if($('form[name="faq-ui-dialog"] input[name="PHONE"]').val() == '' ){
Error=true;
ErrorList+='Вы не ввели телефон или ввели его не верно!<br/>';
}
@Elvinz
Elvinz / multiple-3rd-party-widgets.js
Created March 7, 2020 07:14 — forked from zenorocha/multiple-3rd-party-widgets.js
Loading multiple 3rd party widgets asynchronously
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@Elvinz
Elvinz / init.php
Created April 20, 2020 06:30 — forked from d1i1m1o1n/init.php
Bitrix detect mobile devices and enable mobile template and redirect to mobile folder
<?
define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/log.txt");
//define('siteType', 'dev');
//Определяем мобильные устройства библиотекой http://mobiledetect.net/
require_once 'include/Mobile_Detect.php';
$detect = new Mobile_Detect;
//Все мобилные устройства кроме планшетов
if( $detect->isMobile() && !$detect->isTablet() ){
$('.order').click(function(){
var ide = $(this).parent().find('input:hidden').val();
$.ajax({
type: "POST",
data: 'action=ADD2BASKET&ajax_basket=Y&id='+ide,
url: '/',
success: function(data){
data = data.split('\'').join('\u0022');
var obj = JSON && JSON.parse(data) || $.parseJSON(data);
if (obj.STATUS == 'OK'){
<?if (!empty($arResult["PROPERTIES"]["MORE_PHOTO"]["VALUE"])):?>
<?foreach($arResult["PROPERTIES"]["MORE_PHOTO"]["VALUE"] as $photo):?>
<img src="<?=CFile::GetPath($photo)?>" />
<?endforeach?>
<?endif?>
//Пояснения: MORE_PHOTO — это код нашего свойства информационного блока в Битрикс. GetPath это метод класса CFile, который просто возвращает путь к нашему изображению — зарегистрированному файлу. И выводить элементы лучше из массива $arResult[«DISPLAY_PROPERTIES»] — давайте уважать редакторов контента =)
//Если нам нужно сразу отмасштабировать изображение…
namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
animation: "fade", //String: Select your animation type, "fade" or "slide"
easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
reverse: false, //{NEW} Boolean: Reverse the animation direction
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
startAt: 0, //Integer: The slide that the slider should start on. Array nota