public function prepare() { $this->template = APP_VIEWS_ROOT . '/templates/partials/tags_menu.php'; $this->setTemplateVariable('block_name', 'categories-menu'); $categoriesModel = new Categories(); // $newsModel = new news(); // var_dump($newsModel->get()); $items = []; foreach ($categoriesModel->get() as $category) { $items['category' . $category['name']] = ['id' => $category['id'], 'text' => $category['title'], 'class' => 'rat-' . round($category['rating'] / 20), 'link' => '/category/' . $category['name']]; } $this->setTemplateVariable('menu_links', $items); $this->setTemplateVariable('active_link', $this->activePage); }