public function actionIndex()
 {
     $query = Design::find();
     $pagination = new Pagination(['defaultPageSize' => 3, 'totalCount' => $query->count()]);
     $bgs = $query->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('index', ['bgs' => $bgs, 'pagination' => $pagination]);
 }
Beispiel #2
0
 public function actionDesign()
 {
     $design_subcategory = DesignSubcategory::find()->all();
     $elements = [];
     foreach ($design_subcategory as $key => $value) {
         $element = Design::find()->select(['id', 'title', 'main_img'])->where(['show_item' => 1, 'id_cat' => $value->id])->orderBy('rand()')->one();
         if (count($element) == 0) {
             $element = $value;
         } else {
             $element['alias'] = $value->alias;
         }
         $elements[$value->name] = $element;
     }
     return $this->render('design', ['elements' => $elements]);
 }
Beispiel #3
0
 private static function getDesign($page, $filter)
 {
     // число элементов на странице по умолчанию
     $defaultPageSize = 6;
     $query = Design::find()->select(['id', 'title', 'intro_text', 'main_img'])->where(['show_item' => 1]);
     // общее число элементов, которые будут выведены на страницу
     $totalCount = $query->count();
     // создаем объект постраничной навигации
     $pagination = self::getPagination($defaultPageSize, $totalCount, $page, $filter);
     $elements = $query->limit($pagination->limit)->offset($pagination->offset)->all();
     return ['pagination' => $pagination, 'elements' => $elements];
 }
Beispiel #4
0
<?php

$this->title = 'Capitalov.com Эксклюзивные финансовые услуги';
$design = \app\models\Design::find(1);
?>
<!-- Header Carousel -->
<header id="myCarousel" class="carousel slide">
    <!-- Indicators -->
    <ol class="carousel-indicators">
        <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
        <li data-target="#myCarousel" data-slide-to="1"></li>
        <li data-target="#myCarousel" data-slide-to="2"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner">
        <div class="item active">
            <div class="fill" style="background-image:url('<?php 
echo $design->getImg(1);
?>
');"></div>
            <div class="carousel-caption">
            </div>
        </div>
        <div class="item">
            <div class="fill" style="background-image:url('<?php 
echo $design->getImg(2);
?>
');"></div>
            <div class="carousel-caption">
            </div>