public function actionIndex() { $mainSlider = Slider::find()->all(); $gallery = Gallery::find()->all(); $blog = Blog::find()->limit(2)->all(); return $this->render('index', ['mainSlider' => $mainSlider, 'gallery' => $gallery, 'blog' => $blog]); }
public function postDestroy() { $slide = Slider::find(Input::get('id')); if ($slide) { File::delete('public/img/slider/' . $slide->image); $slide->delete(); return Redirect::back()->with('message', 'Элемент удален'); } return Redirect::back()->with('message', 'Ошибка удаления'); }
/** * @inheritdoc */ public function init() { parent::init(); if ($this->slider_id === null && $this->slider_name === null && $this->slider === null) { throw new InvalidConfigException("Either slider, slider_id or slider_name should be set."); } if ($this->slider === null) { if ($this->slider_name !== null) { $this->slider = Yii::$app->cache->get("Slider:name:" . $this->slider_name); if ($this->slider === false) { $this->slider = Slider::find()->where(['name' => $this->slider_name])->one(); Yii::$app->cache->set("Slider:name:" . $this->slider_name, $this->slider, 86400, new \yii\caching\TagDependency(['tags' => [ActiveRecordHelper::getCommonTag(Slider::className())]])); } } else { $this->slider = Slider::findById($this->slider_id); } } }
/** * Lists all Slider models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Slider::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }
public function actionIndex() { $orderProducts = new OrderProducts(); $productCategories = new ProductCategories(); return $this->render('index', ["slider" => Slider::find()->orderBy('ordering ASC')->asArray()->all(), "topSelling" => $orderProducts->getTopSellingProducts(9), "categoryProducts" => $productCategories->getCatLowCostProducts()]); }
public function orderMin($langs = null, $cid = null) { if ($langs == null) { $langs = 'thai'; } $query = Slider::find()->where(['cid' => $cid, 'langs' => $langs])->min('ordering'); return $query; }
$this->registerMetaTag(['name' => 'description', 'content' => $dataPage->meta_description]); ?> <div class="g w1140 main"> <!-- slider --> <div class="herounit blue-gradient-bg"> <div class="g w1140 slider"> <a href="#"><img class="r" src="/images/slide-01.png" alt=""></a> <?php // $images = [ // Html::a(Html::img("http://goods.marketgid.com/img/new-year.jpg", ['alt' => 'Для праздников и карнавалов', 'title' => 'Для праздников и карнавалов']), ['category/dla_prazdnikov_i_karnavalov/2054']), // Html::a(Html::img("http://goods.marketgid.com/img/appliances.png", ['alt' => 'Бытовая техника', 'title' => 'Бытовая техника']), ['category/bytovaa_tehnika/8']), // Html::a(Html::img("http://goods.marketgid.com/img/auto.png", ['alt' => 'Автотовары', 'title' => 'Автотовары']), ['category/avto_velo_moto/6']), // //Html::a(Html::img("/img/chancellery.png", ['alt' => 'Канцелярия', 'title' => 'Канцелярия']), ['category/kancelarskie_prinadleznosti/1246']), // ]; $slider = \app\models\Slider::find()->all(); $images = []; foreach ($slider as $slide) { $images[] = Html::a(Html::img($slide->src, ['alt' => $slide->title, 'title' => $slide->title]), [$slide->url]); } // // echo yii\bootstrap\Carousel::widget(['items' => $images, 'controls' => false]); // echo Slick::widget([ // // // HTML tag for container. Div is default. // 'itemContainer' => 'div', // // // HTML attributes for widget container // 'containerOptions' => ['class' => 'container'], // // // Items for carousel. Empty array not allowed, exception will be throw, if empty