/** * Url: /album/{$album_id}-{$slug}/{$photo_id} * @param int $album_id Album id * @param string $slug Album slug * @param $photo_id * @return mixed Content * @throws NotFoundHttpException */ public function actionPhoto($album_id, $slug, $photo_id) { $album = Album::find()->where(['id' => $album_id, 'is_public' => 1])->one(); if (!isset($album)) { throw new NotFoundHttpException('Страница не найдена.'); } $photo = Asset::find()->where(['id' => $photo_id, 'thumbnail' => Asset::THUMBNAIL_CONTENT])->one(); if (!isset($photo)) { $photo = Asset::find()->where(['id' => $photo_id])->one(); } if (!isset($photo)) { throw new NotFoundHttpException('Страница не найдена.'); } return $this->render('@frontend/views/site/index', ['templateType' => 'col2', 'title' => 'Dynamomania.com | Фотоальбом: ' . $album->title, 'columnFirst' => ['content' => ['view' => '@frontend/views/site/photo_single', 'data' => compact('album', 'photo')], 'comments' => Comment::getCommentsBlock($photo->id, Comment::COMMENTABLE_PHOTO)], 'columnSecond' => ['short_news' => SiteBlock::getshortNews(50)]]); }