public function action_material() { $materials = new Model_Material('groups'); //получаем url материала $materialUrl = $this->request->param('id'); $categoryUrl = $this->request->param('category'); View::set_global('categoryName', $categoryUrl); $category = new Model_Category('tree'); $categoryId = $category->getCategoryIdByUrl($categoryUrl); $categoryTitle = $category->getCategory($categoryId); $subcategoryUrl = $this->request->param('subcategory'); if ($subcategoryUrl) { $categoryId = $category->getCategoryIdByUrl($subcategoryUrl); } $groupId = $materials->getGroupFromCategory($categoryId); $materialId = $materials->getMaterialIdByUrl($materialUrl, $groupId); $material = $materials->getMaterial($materialId); $fields = $materials->getFields2($materialId, TRUE); $title = ''; $category_url = $this->request->param('category'); $category_id = $category->getCategoryIdByUrl($category_url); $category_data = $category->getCategory($category_id); $material_url = $this->request->param('id'); $group_id = $materials->getGroupFromCategory($category_id); $material_id = $materials->getMaterialIdByUrl($material_url, $group_id); $material_data = $materials->getMaterial($material_id); $this->template->title = $title . ' ' . $material['name']; $this->template->page_title = $material['name']; $this->template->keywords = $material['keywords']; $this->template->description = $material['description']; $this->template->styles = $this->getStyles($this->styles); if (!$material['id']) { throw new HTTP_Exception_404(); } //обновляем просмотры $materials->updateViews($material['id']); $widgets[] = Request::factory('widgets/material/index/' . $material['id'])->execute(); $this->template->block_center = $widgets; }