From 05f1b3e25d0e180e43f9d310dceffa2979c907f4 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 11 May 2017 12:03:04 +0300 Subject: [PATCH] -Blog at main --- frontend/controllers/SiteController.php | 27 ++++++++++++++++++++------- frontend/views/site/index.php | 637 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2 files changed, 315 insertions(+), 349 deletions(-) diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index a38fc76..01f8020 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -6,6 +6,7 @@ use artbox\catalog\models\Category; use artbox\catalog\models\Product; use artbox\core\models\Feedback; + use artbox\weblog\models\Article; use common\models\LoginForm; use common\models\PasswordResetRequestForm; use common\models\ResetPasswordForm; @@ -92,6 +93,17 @@ ->limit(6) ->with('image') ->all(); + $articles = Article::find() + ->orderBy('sort') + ->with( + [ + 'lang', + 'image', + 'category.lang', + ] + ) + ->limit(4) + ->all(); return $this->render( 'index', [ @@ -102,6 +114,7 @@ 'productCount' => $productCount, 'brandCount' => $brandCount, 'brands' => $brands, + 'articles' => $articles, ] ); } @@ -185,7 +198,7 @@ if (!\Yii::$app->user->isGuest) { return $this->redirect([ 'index' ]); } - + $loginForm = new LoginForm(); $signupForm = new SignupForm(); if ($loginForm->load(\Yii::$app->request->post()) && $loginForm->login()) { @@ -216,7 +229,7 @@ public function actionLogout() { \Yii::$app->user->logout(); - + return $this->redirect([ 'index' ]); } @@ -231,7 +244,7 @@ if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendEmail()) { Yii::$app->session->setFlash('success', 'Check your email for further instructions.'); - + return $this->redirect([ 'index' ]); } else { Yii::$app->session->setFlash( @@ -240,7 +253,7 @@ ); } } - + return $this->render( 'requestPasswordResetToken', [ @@ -264,13 +277,13 @@ } catch (InvalidParamException $e) { throw new BadRequestHttpException($e->getMessage()); } - + if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) { Yii::$app->session->setFlash('success', 'New password saved.'); - + return $this->redirect([ 'index' ]); } - + return $this->render( 'resetPassword', [ diff --git a/frontend/views/site/index.php b/frontend/views/site/index.php index def49d2..617c1dc 100755 --- a/frontend/views/site/index.php +++ b/frontend/views/site/index.php @@ -3,7 +3,10 @@ use artbox\catalog\models\Category; use artbox\catalog\models\Product; use artbox\core\components\SeoComponent; + use artbox\core\helpers\ImageHelper; + use artbox\weblog\models\Article; use yii\bootstrap\Html; + use yii\helpers\Url; use yii\web\View; /** @@ -16,387 +19,337 @@ * @var int $productCount * @var Brand[] $brands * @var SeoComponent $seo + * @var Article[] $articles */ $this->title = 'My Yii Application'; $seo = Yii::$app->get('seo'); ?>
-
- -
-

-
- - - -
-

-
- - -
-

-
- - -
-
- -
-
-
-
-
-
-
-


- - Позиций товаров

-
+
+ +
+

-
-
-
-
-


- - Брендов

-
+ + -
-
-
-
-

12 ... 36
- - Месяцев Гарантия

-
+ +
+

-
- -
- -
- - -
-
-
-
-
-

+ + +
+

+
+ + +
+
+ +
+
+ +
+
+
+
+
+
+
+


+ + Позиций товаров

+
+
+
+
+
+
+


+ + Брендов

+
+
+
+
+
+
+

12 ... 36
+ + Месяцев Гарантия

+
+
+
+ +
+ +
+ + +
+
+
+
+
+

+
+ + +
-
+ + + + - -
- -
-
-

Полезные статьи

-
- -

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies - mi vitae est. Mauris placerat eleifend leo. Check our blog! -

- - - -
-
-
-
-
- -
-
-
-

- Read more -

-
-
-
-

Fashion now

-

By John Snow in Webdesign -

-

Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.

-

- Continue reading -

-
-
- - -
- -
-
-
-
- -
-
-
-

- Read more -

-
-
-
-

Fashion now

-

By John Snow in Webdesign -

-

Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.

-

- Continue reading -

-
-
- - -
- -
-
-
-
- -
-
-
-

- Read more -

-
-
-
-

What to do

-

By John Snow in Webdesign -

-

Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.

-

- Continue reading -

-
-
- - + +
+ + +
+
+
+
+ image ? $article->image->getPath() : '@frontend/web/img/no-image.png' + ) + ->cropResize(255, 192) + ->renderImage( + [ + 'class' => 'img-responsive', + 'alt' => $article->lang->title, + ] + ) ?> +
+
+
+

+ Read more +

+
- -
-
-
-
- -
-
-
-

- Read more -

-
-
-
-

5 ways to look awesome

-

By John Snow in Webdesign -

-

Am terminated it excellence invitation projection as. She graceful shy believed distance use nay. Lively is people.

-

- Continue reading -

-
-
- - +
+

lang->title; ?>

+ category) ) { ?> +

category->lang->title ?> + +

+

lang->body_preview; ?>

+

+ Continue reading +

- +
+
- - - - -
+ + +
+ + +
- + +
+ - */ -?> +
-
-
- text; ?> -
+
+
+ text; ?>
+
-- libgit2 0.21.4