скрипт выводит только строку title в таблице news
SELECT title FROM news
<div class="container">
<div class="row">
<?php
for($i = 0; $i < 10; $i++)
{
echo '<div class="col-md-4 col-xs-12">Запись '.$i.'</div>';
if ($i % 3 == 2)
{
echo '</div>';
echo '<div class="row">';
}
}
?>
</div>
</div>
$ar = range(0, 11);
$size = count($ar) - 1;
foreach($ar as $i => $v)
{
echo '<div class="col-md-4 col-xs-12">Запись '.$v.'</div>';
if ($v % 3 == 2 && $i < $size)
{
echo '</div>';
echo '<div class="row">';
}
}
You may also pass in a matrix while instantiating the PF.Grid class. It will initiate all the nodes in the grid with the same walkability indicated by the matrix. 0 for walkable while 1 for blocked.
matrix [координата Y (номер строки)] [координата X (номер колонки)]
document.querySelector("#nav-toggle")
if ($(window).width() > 991) {
$("#nav-toggle").on("click", function() {
$(this).toggleClass("active");
});
}
$order->get_new_events_count('comments') > 0
(это может быть true или false). echo true; // выведет "1"
echo false; // выведет "" (пустую строку).
<?php
$new_events = $order->get_new_events_count('comments');
?>
<?php if ($new_events > 0): ?>
<?= $new_events; ?>
<?php endif; ?>
<? if (($new_events = $order->get_new_events_count('comments')) > 0): ?>
<?= $new_events; ?>
<? endif; ?>
if ($foo = $bar)
, вместо if ($foo == $bar)
var classes = ['item-id', 'item-title', 'item-price', 'delete-btn'];
$('#sf tr').each(function () {
var $cell = $('<td>').append('<a class="add_item">Добавить в корзину</a>');
$(this).append($cell);
$(this).find('td').each(function (index, element) {
$(element).addClass(classes[index]);
});
});
var classes = ['item-id', 'item-title', 'item-price', 'delete-btn'],
$rows = $('#sf tr').filter(':gt(0)'),
$link = $('<a>').addClass('add_item').text('Добавить в корзину'),
$cell = $('<td>').append($link),
$cells;
$rows.append($cell);
$cells = $rows.find('td');
$cells.each(function (index, cell) {
$(cell).addClass(classes[index % classes.length]);
});
На сколько я поля это фишка асинхронности !?Правильно поняли.
Это получается нужно код выстраивать цепочкой из калбэков ?Необязательно. (для nodejs, понятно, своя специфика, но общие принципы такие же, естественно).
$(document).ready(function () {
var owl = $(".sldr").owlCarousel().data('owlCarousel');
$(window).on('mousewheel', debounce(function (event) {
var direction = event.originalEvent.deltaY < 0 ? 'next' : 'prev';
owl[direction]();
}, 100));
});
function debounce(func, wait, immediate) {
var timeout, args, context, timestamp, result;
var later = function () {
var last = new Date().getTime() - timestamp;
if (last < wait && last >= 0) {
timeout = setTimeout(later, wait - last);
} else {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
if (!timeout) context = args = null;
}
}
};
return function () {
context = this;
args = arguments;
timestamp = new Date().getTime();
var callNow = immediate && !timeout;
if (!timeout) timeout = setTimeout(later, wait);
if (callNow) {
result = func.apply(context, args);
context = args = null;
}
return result;
};
}