Skip to content

Instantly share code, notes, and snippets.

@d1i1m1o1n
d1i1m1o1n / scripts.js
Created November 20, 2015 08:13
Fixed block while scroll page
//Фиксируем форму обратной связи
var $section_of_form = $("#fixed_scroll_form").closest('section'),
fixed_scroll_form = $section_of_form.offset().top - 50;
//Выставляем текущую ширину
$section_of_form.css('width', $section_of_form.css('width'));
$(window).bind("scroll", function() {
var offset = $(this).scrollTop();
if (offset >= fixed_scroll_form && !$section_of_form.hasClass("fixed_scroll_form")) {
$section_of_form.addClass('fixed_scroll_form');
@d1i1m1o1n
d1i1m1o1n / scripts.js
Created November 20, 2015 11:23
Fixed block between footer and header
if($("#fixed_scroll_form").length) {
//Фиксируем форму обратной связи
var $section_of_form = $("#fixed_scroll_form").closest('section');
//Выставляем текущую ширину
$section_of_form.css('width', $section_of_form.css('width'));
var top = $section_of_form.offset().top-50;
var height = parseInt($section_of_form.css('height'), 10);
var winHeight = height;//$(window).height()+300;
var footerTop = $('.page-footer').offset().top+300;
var gap = 7;
@d1i1m1o1n
d1i1m1o1n / header.php
Created November 23, 2015 14:32
Bitrix. Set data in component template and output in site template
<?php if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<div id="content">
<?php $APPLICATION->ShowViewContent('content'); ?>
</div>
@d1i1m1o1n
d1i1m1o1n / form.php
Created November 23, 2015 14:33
Bitrix. Standart bitrix form
<form method="post" action="<?php echo POST_FORM_ACTION_URI?>">
<?php echo bitrix_sessid_post()?>
<input type="submit" name="submit" value="Submit">
</form>
@d1i1m1o1n
d1i1m1o1n / empty.php
Created November 23, 2015 14:34
Bitrix. Page without header and footer
<?php
define('NO_AGENT_CHECK', true);
define("STOP_STATISTICS", true);
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
//ajax
/*if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || empty($_SERVER['HTTP_X_REQUESTED_WITH'])
|| strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') return;*/
@d1i1m1o1n
d1i1m1o1n / .htaccess
Created November 23, 2015 14:35
Bitrix .htaccess
Options -Indexes
ErrorDocument 404 /404.php
<IfModule mod_php5.c>
php_flag session.use_trans_sid off
php_value display_errors 1
php_value mbstring.internal_encoding UTF-8
</IfModule>
<IfModule mod_rewrite.c>
@d1i1m1o1n
d1i1m1o1n / .bottom.menu_ext.php
Last active November 24, 2015 06:57
Bitrix menu ext. Get subdirectories from current directory
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
if(CModule::IncludeModule("iblock")) {
$IBLOCK_ID = 174;
//пример выборки подразделов для раздела
$rsParentSection = CIBlockSection::GetList(array(), array('IBLOCK_TYPE' => '1c_catalog', 'IBLOCK_ID' => $IBLOCK_ID, 'CODE' => $_REQUEST["SECTION_CODE"]));
if ($arParentSection = $rsParentSection->GetNext()) {
$arFilter = array('IBLOCK_ID' => $IBLOCK_ID,'>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'],'<RIGHT_MARGIN' => $arParentSection['RIGHT_MARGIN'],'DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']+1); // выберет потомков без учета активности
$rsSect = CIBlockSection::GetList(array('left_margin' => 'asc'),$arFilter);
@d1i1m1o1n
d1i1m1o1n / .parameters.php
Created November 24, 2015 07:02
Битрикс. Bitrix. Шпаргалка. Textarea в настройках компонента через параметр CUSTOM
$arTemplateParameters = Array(
...
"TEXT_INTRO" => Array(
"PARENT" => "DATA_SOURSE",
"NAME" => "Вступительный текст",
"TYPE" => "CUSTOM",
"JS_FILE" => "/путь/к/файлу/settings.js",
"JS_EVENT" => "OnTextAreaConstruct",
"DEFAULT" => null,
),
@d1i1m1o1n
d1i1m1o1n / template.php
Last active April 2, 2016 13:38
Bitrix list of addresses with yandex map
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
/** @var array $arParams */
/** @var array $arResult */
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @global CDatabase $DB */
/** @var CBitrixComponentTemplate $this */
/** @var string $templateName */
/** @var string $templateFile */
/** @var string $templateFolder */
@d1i1m1o1n
d1i1m1o1n / detail.php
Created December 2, 2015 08:38
Bitrix show similar products
<?$GLOBALS['arrrFilter'] = array('!CODE' => $arResult["CODE"]); //это наш фильтр, который исключает товар, на странице которого мы находимся?>
<?$APPLICATION->IncludeComponent(
"bitrix:catalog.section",
$catalog_section_template,
array(
"IBLOCK_TYPE" => "1c_catalog",
"IBLOCK_ID" => "174",
"SECTION_ID" => $arResult["IBLOCK_SECTION_ID"],
"SECTION_CODE" => "",
"SECTION_USER_FIELDS" => array(