<?php use yii\helpers\Html; // 300 170 use common\models\Example; $example_model = Example::findOne($model->example_id); ?> <? //print_r($myPage); ?> <? //print_r($index); ?> <? //print_r($widget); ?> <div class="portfolio_example" style="background:url('/image/shadow2.png'), url('/uploads/<?php echo $model->id; ?> .jpg') center center; background-size: auto 100%;"> <span class="portfolio_logo"> <img src="/uploads/<?php echo $model->id; ?> _logo.png"> </span> <div class="portfolio_overlay"></div> <!-- style="background:#<?php echo $model->color; ?> " -->
// Получаем значение переменной, отвечающей за номер отображаемого решения $example_id = Yii::$app->request->get('example_id'); // Получаем значение переменной, отвечающей за номер услуги $service_id = Yii::$app->request->get('service_id'); // Если пример определен if ($example_id) { // Услуги по данному примеру $services = Service::getExmapleServices($example_id); $example = Example::findOne($example_id); } // Если услуга определена if ($service_id) { // Услуги по данному примеру $service = Service::findOne($service_id); } // Решения по услуге "создание сайтов" (1) $examples = Example::find()->where(['service_id' => $model->service_id])->all(); ?> <?php
/** * Finds the Example model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Example the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Example::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }