Commit 193ead1b68f3083d3132642931edee3d8716eed1
1 parent
a2a2cc51
big commti
Showing
3 changed files
with
45 additions
and
6 deletions
Show diff stats
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace frontend\controllers; | ||
| 4 | + | ||
| 5 | +use Yii; | ||
| 6 | +use yii\web\Controller; | ||
| 7 | +use common\models\Page; | ||
| 8 | +use yii\web\HttpException; | ||
| 9 | + | ||
| 10 | +class TextController extends Controller | ||
| 11 | +{ | ||
| 12 | + | ||
| 13 | + public function actionIndex() | ||
| 14 | + { | ||
| 15 | + | ||
| 16 | + if(!$modelText = Page::find()->where(['translit'=>$_GET['translit']])->one()) | ||
| 17 | + throw new HttpException(404, 'Данной странице не существует!'); | ||
| 18 | + | ||
| 19 | + return $this->render('index', [ | ||
| 20 | + 'text'=>$modelText, | ||
| 21 | + ]); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | +} | ||
| 0 | \ No newline at end of file | 25 | \ No newline at end of file |
frontend/views/layouts/main.php
| @@ -91,12 +91,11 @@ use frontend\widgets\Seo; | @@ -91,12 +91,11 @@ use frontend\widgets\Seo; | ||
| 91 | </ul> | 91 | </ul> |
| 92 | </div> | 92 | </div> |
| 93 | </li> | 93 | </li> |
| 94 | - <li><?php echo Html::a('Магазины', Url::to('site/contacts')) ?></li> | ||
| 95 | - <li><?php echo Html::a('Скидки', Url::to('site/contacts')) ?></li> | ||
| 96 | - <li><?php echo Html::a('Гарантии', Url::to('site/contacts')) ?></li> | ||
| 97 | - <li><?php echo Html::a('Оплата', Url::to('site/contacts')) ?></li> | ||
| 98 | - <li><?php echo Html::a('Доставка', Url::to('site/contacts')) ?></li> | ||
| 99 | - <li><?php echo Html::a('Контакты', Url::to('site/contacts')) ?></li> | 94 | + <li><?php echo Html::a('Магазины',Url::to (['text/index', 'translit' => 'magaziny'])) ?></li> |
| 95 | + <li><?php echo Html::a('Скидки', Url::to (['text/index', 'translit' => 'oplata-i-dostavka'])) ?></li> | ||
| 96 | + <li><?php echo Html::a('Гарантии', Url::to (['text/index', 'translit' => 'garantii'])) ?></li> | ||
| 97 | + <li><?php echo Html::a('Оплата', Url::to (['text/index', 'translit' => 'oplata'])) ?></li> | ||
| 98 | + <li><?php echo Html::a('Доставка', Url::to (['text/index', 'translit' => 'dostavka-tovarov'])) ?></li> | ||
| 100 | </ul> | 99 | </ul> |
| 101 | </div> | 100 | </div> |
| 102 | <div class="col-md-3 col-lg-2"> | 101 | <div class="col-md-3 col-lg-2"> |
| 1 | +<?php | ||
| 2 | +use yii\widgets\Breadcrumbs; | ||
| 3 | +?> | ||
| 4 | +<?php | ||
| 5 | +$this->title = $text->meta_title; | ||
| 6 | +$this->registerMetaTag(['name' => 'description', 'content' => $text->meta_description]); | ||
| 7 | +$this->registerMetaTag(['name' => 'keywords', 'content' => $text->meta_keywords]); | ||
| 8 | +?> | ||
| 9 | + | ||
| 10 | +<div class="container"> | ||
| 11 | + | ||
| 12 | + <div class="content"> | ||
| 13 | +<h1><?=$text->title;?></h1> | ||
| 14 | +<?=$text->body;?> | ||
| 15 | + </div> | ||
| 16 | +</div> | ||
| 0 | \ No newline at end of file | 17 | \ No newline at end of file |