public function getComment($postID)
{
return $this->hasMany(ComentsBlogObject::changeDB($postID)::className(),['post_id' => 'id'])->select('COUNT(*)');
}
$model = ArticleBlog::find()->limit(3)->all();
foreach ($model as $key => $value) {
print_r($value->getComment($value->id)->count() );
}
"db_name"
News::find()->where(['news.visibility'=>1])
->innerJoin(['nc' => 'db_name' . NewsComments::tableName()], 'nc.news_id = news.id')
->groupBy('news.id')
->orderBy('COUNT(nc.id) DESC, news.date DESC');
command denied to user 'u670329544_test2'@'10.2.1.31' for table 'brk_comments'
public function getTags()
{
return $this->hasMany(Tags::className(), ['id' => 'tag_id'])->viaTable('{{%statjiblogtags}}', ['post_id' => 'id']);
}
$juzer_photo = $this->find()->where(['juzer_id' => 10])
->andWhere(['>', 'date', new Expression('LAST_DAY(CURDATE()) + INTERVAL 1 DAY - INTERVAL 1 MONTH') ])
->andWhere(['<', 'date', new Expression('DATE_ADD(LAST_DAY(CURDATE()), INTERVAL 1 DAY)') ])
->one();
use yii\db\Expression;
var csrfParam = '_csrf';
var csrfValue = $('meta[name=csrf-token]').attr("content");
$(document).off('click', '.cke_dialog_tabs a:eq(1)').on('click', '.cke_dialog_tabs a:eq(1)', function () {
console.log('Вася');
var $form = $('.cke_dialog_ui_input_file iframe').contents().find('form');
if (!$form.find('input[name=' + csrfParam + ']').length) {
var csrfTokenInput = $('<input/>').attr({
'type': 'hidden',
'name': csrfParam
}).val(csrfValue);
$form.append(csrfTokenInput);
}
});
cke_dialog_tabs a:eq(1)
- Единичка тут потому что при клике в визуальном редакторе на добавить фото, открывается iframe с вкладками, в моем случае "Загрузка файла" - это вторая вкладка, поэтому у меня eq(1), У вас может 3-тьей вкладкой, тогда будет eq(2). var i = 15;
var acc = 0;
var timerId = setTimeout(function go() {
console.log(acc);
if (i > 0)
{
acc++;
if(acc > 3 ){ acc = 0; }
//console.log(acc);
setTimeout(go, 100);
};
i--;
}, 100);
$model = Tags::find()->andWhere(['slug'=> Yii::$app->getRequest()->getQueryParam('slug') ])->one();
$query = $model->getPosti();
$pagination = new Pagination([
'defaultPageSize' => 1,
'totalCount' => $query->count()
]);
$query = $query->orderBy(['id' => SORT_DESC])
->offset($pagination->offset)
->limit($pagination->limit)
->all();
return $this->render('tag', [
'model' => $query,
'pagination' => $pagination
]);
<?= LinkPager::widget([
'pagination' => $pagination,
'nextPageLabel' => '»',
'hideOnSinglePage' => true,
//'firstPageLabel' => 'В начало',
//'lastPageLabel' => 'В конец',
'prevPageLabel' => '«'
]) ?>
$('#content .boxcontainer').on('click', 'article button.emb', function(){
$('#content .boxcontainer').children('article').removeClass('active');
$('#content .boxcontainer').children('article').addClass('non_active');
embButtonClick( $(this) );
$(this).parents('article').removeClass('non_active');
$(this).parents('article').addClass('active');
});
function embButtonClick(thisss) {
var block = thisss.next('.meta-data'),
pinbox = thisss.parents('.pinbox');
pinbox.toggleClass('pinbox_active');
if (pinbox.hasClass('pinbox_active')) {
block.slideDown(100);
$(document).on('click', function(event) {
if ($(event.target).closest(pinbox).length) {
if (!$('.modal-backdrop').length)
$('body').append('<div class="modal-backdrop fade in"></div>');
$('.modal-backdrop').bind('click', ModalBackdropClear);
return;
}
block.hide(100);
pinbox.removeClass('pinbox_active');
$('.modal-backdrop').remove();
event.stopPropagation();
});
}
}
function ModalBackdropClear(){
$('#content .boxcontainer').children('article').removeClass('active non_active');
}
$training=new WP_Query($args);
$paginate = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'type' => 'array',
'total' => $query->max_num_pages,
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'mid_size'=>1,
'prev_text' => __('«'),
'next_text' => __('»'),
)
);
if ($query->max_num_pages > 1) :
$query на $training
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
$program = new WP_Query(
array(
'post_type' => 'program',
'posts_per_page' => 8,
'paged' => $paged) );
<?php if ( $program->max_num_pages > 1 ) : ?>
<div class="paginate">
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $program->max_num_pages,
'prev_text' => '',
'next_text' => ''
) );
?>
</div>
<?php endif; ?>
var tempScrollTop = 10, currentScrollTop = 0;
var top1;
jQuery('.popup-post.active').scroll(function(){
currentScrollTop = jQuery(this).scrollTop();
if (tempScrollTop < currentScrollTop ){ //Скролим вниз
jQuery('.vverh').сss('display', 'block');
jQuery('.vniz').сss('display', 'none');
tempScrollTop = currentScrollTop;
top1 = currentScrollTop;
} else if (tempScrollTop > currentScrollTop ) { //Скролим вверх
jQuery('.vverh').сss('display', 'none');
jQuery('.vniz').сss('display', 'block');
tempScrollTop = currentScrollTop;
}
});
jQuery('.vniz').click(function(){
jQuery('popup-post.active').animate({ scrollTop: top1 }, '50');
});
jQuery('.vverh').click(function(){
jQuery('popup-post.active').animate({ scrollTop: jQuery('body').offset().top }, '50');
});
$post_url = explode('/', $_POST['ssilka_objav'], 6);
$post_type = $post_url[3];
$post_zaglav = $post_url[4];
<input name="name" type="text" class="required" aria-required="true" placeholder="Ваше имя">
$('#kont-res-or-run').on('submit', function(e) {
if (!$(this).valid()) return false;
if ($("#kont-res-or-run").length){
$("#kont-res-or-run").validate({
rules:{
telef:{
required: true,
digits: true,
minlength: 10,
maxlength: 15,
},
message:{
required: true,
minlength: 8,
maxlength: 300,
},
}
});
}
$myposts2 = get_posts( array(
'post_type' => 'tovari',
'tax_query' => array(
array(
'taxonomy' => 'razdel-tovar',
'field' => 'slug',
'terms' => 'srochno-prodam'
)
),
'posts_per_page' => 20) );
foreach (array_rand($myposts2, 8) as $currentIn) {
<?php echo $myposts2[$currentIn]->post_title; ?>
}
$(window).scroll(function(){
console.log($(this).scrollTop());
var attrstyle = 'height:' + $(this).scrollTop()/2 + 'px;';
$("#Vash-id").attr('style', attrstyle);
});
<ul><li></li></ul>
в <div></div>
<div></div>
еще один див <div><span>Вверх</span><span>Вниз</span></div>
<div><span>Вверх</span><span>Вниз</span></div>