/** * /snippets/language-slug[/snippet-slug] * * @return string */ public function actionIndex() { $this->parseQueryParams(true); // Make sure at least language slug is there if (!$this->language) { return $this->goHome(); } if ($this->snippet) { $this->snippet->updateCounters(['views' => 1]); return $this->render('snippet', ['language' => $this->language, 'snippet' => $this->snippet, 'commentModel' => new CommentForm()]); } else { return $this->render('language', ['language' => $this->language, 'latestSnippets' => LatestSnippets::getTopTen($this->language), 'popularSnippets' => PopularSnippets::getTopTen($this->language)]); } }
/** * Site Homepage * * @return string */ public function actionIndex() { return $this->render('index', ['latestSnippets' => LatestSnippets::getTopTen(), 'popularSnippets' => PopularSnippets::getTopTen()]); }