(☞ຈل͜ຈ)☞ Главная  Статьи  Загрузчик Домой

Ok!
Ok!
106
window.i = 1;
setInterval(function( ){
$.ajax({
            type: 'get',
            url: 'https://shop.lamaree.ru/agree/letter.php?iter=' + window.i + '&pass=q12345Q&test=1',
            data: '',
            dataType: "html",
            success: function (data) {
                console.log(window.i);
            }
        });
++window.i;
},1000)
рассылка, скрипт, ajax3450Скрипт рассылки раз в секунду для консоли
105
<a id="ajaxaction=add&ajaxaddid=<?=$ar_fields['ID'];?>" rel="nofollow" class="catalog-item-buy input-basket-submit" href="?action=ADD2BASKET&id=<?=$ar_fields['ID'];?>">В корзину</a>
bitrix, в корзину560Код кнопки добавления в корзину итрикс
104
width: expression(((document.documentElement.clientWidth || document.body.clientWidth) < 1050)? "1050px" : "100%");
expression, css690Применение expression в css
103
$data = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $data);
var_dump(unserialize($data));
replace, serialized510recalculating the length of the elements in serialized array
102
"ELEMENT_SORT_FIELD" => "catalog_PRICE_1",
"ELEMENT_SORT_ORDER" => "asc"
сортировка, цена, битрикс230Сортировка каталога по цене в Битрикс
101
/bitrix/modules/main/include.php replace OLDSITEEXPIREDATE by (exmpl) time() + 86400 * 3
bitrix100replace old site expire date
100
<?if($_REQUEST) {
	if ( htmlspecialchars( $_REQUEST['mail'], 3 ) != ''
	     && strpos( htmlspecialchars( $_REQUEST['mail'], 3 ), '@' ) != false
	) {
		$to = '[email protected]'; 
		$to2 .= htmlspecialchars( $_REQUEST['mail'] );
		$subject  = 'Сообщение с сайта' . $_SERVER['HTTP_HOST'];
		$subject2 = 'Ваше сообщение на сайт ' . $_SERVER['HTTP_HOST'];
		$message = '
<html>
<head>
  <title>Сообщение с сайта ' . $_SERVER['HTTP_HOST'] . '</title>
</head>
<body>
  <p>С сайта отправлено соощение:</p>
  <table cellpadding=10>
    <tr>
      <th style="background-color:#ccc; color:white">Имя</th><th style="background-color:#ccc; color:white">Почта</th><th style="background-color:#ccc; color:white">Дата</th><th style="background-color:#ccc; color:white">Время</th>
    </tr>
    <tr>
      <td>' . htmlspecialchars( $_REQUEST['name'],3 ) . '</td><td>' . htmlspecialchars( $_REQUEST['mail'],3 ) . '</td><td>' .
		           date( 'd-m-Y' ) . '</td><td>' . date( 'H:s' ) . '</td>
    </tr>
    <tr>
      <td colspan=4>' . htmlspecialchars( $_REQUEST['text'],3 ) . '</td>
    </tr>
  </table>
</body>
</html>
';
$message2 = '
<html>
<head>
  <title>Сообщение с сайта' . $_SERVER['HTTP_HOST'] . '</title>
</head>
<body>
  <p>Вы отправили сообщение на сайт ' . $_SERVER['HTTP_HOST'] . '. С вами свяжутся в ближайшее время, спасибо.</p>
  
</body>
</html>
';


		$headers = 'MIME-Version: 1.0' . "
";
		$headers .= 'Content-type: text/html; charset=utf-8' . "
";
		$headers .= 'To: Admin <' . $to . '>' . "
";
		$headers .= 'From: Reglass <' . $to . '>' . "
";
		$headers2 = 'MIME-Version: 1.0' . "
";
		$headers2 .= 'Content-type: text/html; charset=utf-8' . "
";
		$headers2 .= 'To: ' . htmlspecialchars( $_REQUEST['name'] ) . ' <' . htmlspecialchars( $_REQUEST['mail'] ) . '>' . "
";
		$headers2 .= 'From: Reglass <' . $to . '>' . "
";


		if($y = mail( $to, $subject, $message, $headers )
		&& $y2 = mail( $to2, $subject2, $message2, $headers2 )) {
			echo '<script>alert(Спасибо. Сообщение отправлено.); document.location="/"</script>';
		}
	}
}
?>
php, mail230Отправка письма php
99
DELETE t1 FROM contacts t1
        INNER JOIN
    contacts t2 
WHERE
    t1.id < t2.id AND t1.email = t2.email;
удалить, mysql, дупликаты2900Удалить дублирующиеся строки базы
98
onerror="this.src='/bitrix/templates/persona/images/<?=strtolower(str_replace(' ', '-', $arItem['PROPERTY_BRAND_VALUE']))?>-pale.jpg'; this.setAttribute('data-err', 'true')"
дефолт, картинка, img220В случае, если картинки нет, то прописать свойство (здесь название бренда) в качестве дефолтной картинки
97
<link rel="stylesheet" href="/animate.min.css" media="none" onload="if(media!='all')media='all'"><noscript><link rel="stylesheet" href="/animate.min.css"></noscript>
link, ускорение загрузки130Ускорение загрузки сайта уменьшением загрузки css
96
function resizeAndConvertImageWebP(
    $width,
    $height,
    $density,
    $originalFilepath,
    $resizedFilepath) {
  $newWidth = $width * $density;
  $newHeight = $height * $density;

  $image = new Imagick($originalFilepath);
  $origImageDimens = $image->getImageGeometry();
  $origImgWidth = $origImageDimens['width'];
  $origImgHeight = $origImageDimens['height'];

  if($newWidth == 0) {
    $ratioOfHeight = $newHeight / $origImgHeight;
    $newWidth = $origImgWidth * $ratioOfHeight;
  }

  if($newHeight == 0) {
    $ratioOfWidth = $newWidth / $origImgWidth;
    $newHeight = $origImgHeight * $ratioOfWidth;
  }

  $widthRatios = $origImgWidth / $newWidth;
  $heightRatios = $origImgHeight / $newHeight;

  if($widthRatios <= $heightRatios) {
    $cropWidth = $origImgWidth;
    $cropHeight = $newWidth * $widthRatios;
  } else {
    $cropWidth = $newHeight * $heightRatios;
    $cropHeight = $origImgHeight;
  }

  $cropX = ($origImgWidth - $cropWidth) / 2;
  $cropY = ($origImgHeight - $cropHeight) / 2;

  $image->stripImage();
  $image->cropImage($cropWidth, $cropHeight, $cropX, $cropY);
  $image->resizeImage($newWidth, $newHeight, imagick::FILTER_LANCZOS, 0.9);
  $image->setImageFormat('webp');
  $image->setImageAlphaChannel(imagick::ALPHACHANNEL_ACTIVATE);
  $image->setBackgroundColor(new ImagickPixel('transparent'));
  $image->writeImage($resizedFilepath);
}
webp,support,imagemagic140Конвертация картинки в webp в случае, если imageMagic поддрживает
95
<?=(webps() && is_file($_SERVER['DOCUMENT_ROOT'] . str_replace('.jpg', '.webp', $arItem["DETAIL_PICTURE"]["SRC"])))?'style="background-image: url('.str_replace('.jpg', '.webp', $arItem["DETAIL_PICTURE"]["SRC"]).')':'style="background-image: url('.$arItem["DETAIL_PICTURE"]["SRC"].')'?>"
webp,support120Бэкграунд если готов файл webp
94
$webpsupport = (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') >= 0);
if($webpsupport) {
  $this->attemptToServeWebP($pathinfo, $matches, $width, $height, $density);
} else {
  $this->attemptToServeNormal($pathinfo, $matches, $width, $height, $density);
}
webp,support100Определить, поддерживает ли браузер webp картинки
93
<?=($this->GetFolder().'/images/ .... ?>
картинка шаблона инфоблока3200Путь картинки из папки images размещенной в шаблоне компонента
92
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$path = $protocol . $_SERVER['HTTP_HOST'] . SITE_TEMPLATE_PATH;
битрикс, путь1450Путь до файла без слеша на конце
91
При ошибке 502 в импорте инфоблоков Битрикс
Заменить в файле
/bitrix/modules/iblock/admin/iblock_xml_import.php

if($obXMLFile->ReadXMLToDatabase($fp, $NS, $INTERVAL))
на
if($obXMLFile->ReadXMLToDatabase($fp, $NS, 10, $INTERVAL))
502, битрикс, инфоблок, ошибка импорта140Ошибка импорта инфоблока Битрикс 502
90
center iframe {
    width: 100%;
    height: calc(100vw * 9 / 16 );
}
iframe, youtube, height120Установить размер iframe видео с Youtube, подогнать его под мобильный размер. При условии, что видео 100% ширны.
89
$post = get_post();
$t = strtotime($post->post_modified_gmt);
$str = 'Last-Modified: '.gmdate('D, d M Y H:i:s', $t).' GMT';
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $t).' GMT');
daremodified, wp, php1200WP date modified php file
88
document.addEventListener("DOMContentLoaded", function(event) {
    var cl = document.getElementById('#all_otz');
    cl.onclick = function(ev) {
        var post = {};
        post['num_otz'] = 20;
        post['ajax'] = 'y';
        node = BX('video_feed_block');
        if (!!node) {
            BX.ajax.post(
                'https://www.brtclinic.ru/index.php',
                post,
                function (data) {
                    var el = data.getElementById('video_feed_block');
                    node.innerHTML = el.innerHTML();
                }
            );

        }
    }
});
битрикс, битрикс аякс1090Битрикс функция вместо jQuery ajax
87
var setResponsive = function () {
  if ($(window).height() > $("#adminmenuwrap").height() + 50) {
     $('#adminmenuwrap').css('position', 'fixed'); 
  } else {
     $('#adminmenuwrap').css('position', 'relative'); 
  }
}
$(window).resize(setResponsive);
setResponsive();
wp, overflow, height500Функция WP для отображения кнопок левого меню админки пр низком экране
1 2 3 4 5 6 7 8 9 10 11 12 13 14