public static function findCachedBySlug($slug)
{
$query = "slug = '{$slug}'";
$key = HOST_HASH . md5("Page::findFirst({$query})");
$page = self::findFirst([$query, 'cache' => ['key' => $key, 'lifetime' => 60]]);
return $page;
}
public function contactsAction() { $page = Page::findCachedBySlug('contacts'); if (!$page) { throw new Exception("Page 'contacts' not found"); } $this->helper->title()->append($page->getMeta_title()); $this->helper->meta()->set('description', $page->getMeta_description()); $this->helper->meta()->set('keywords', $page->getMeta_keywords()); $this->view->page = $page; $this->helper->menu->setActive('contacts'); }