public function init($article, &$url, &$title, &$teaser = '', &$src = '', $size = 'noresize', &$featured = false, &$id = '') { $objectType = $this->getObjectType($article); $id = $article[$objectType]['id']; $url = SiteRouter::url($article); $title = $article[$objectType]['title']; $teaser = nl2br($article[$objectType]['teaser']); $src = isset($article['Media']) && $article['Media'] && isset($article['Media']['id']) && $article['Media']['id'] ? $this->Media->imageUrl($article, $size) : ''; $featured = $article[$objectType]['featured']; }
public function viewCarType() { $carType = $this->CarType->findBySlug($this->request->param('carType')); if (!$carType && !TEST_ENV) { return $this->redirect('/'); } $conditions = array('CarSubtype.cat_id' => $carType['CarType']['id']); $order = 'CarSubtype.title'; $carSubtype = $this->CarSubtype->find('first', compact('conditions', 'order')); if ($carSubtype) { return $this->redirect(SiteRouter::url($carSubtype)); } $this->set('article', $carType); $this->seo = $carType['Seo']; }
protected function beforeRenderLayout() { $this->loadModel('CategoryProduct'); // ??? на странице если явно не указать objectType - загружаются все статьи - BUG!!! $conditions = array('CategoryProduct.object_type' => 'CategoryProduct'); $order = 'CategoryProduct.sorting ASC'; $aCategories = $this->CategoryProduct->find('all', compact('conditions', 'order')); $this->set('aCategories', $aCategories); foreach ($aCategories as $article) { $url = SiteRouter::url($article); $this->aNavBar['Products']['submenu'][] = array('href' => $url, 'label' => $article['CategoryProduct']['title']); } $this->set('aSlider', $this->Media->getObjectList('Slider')); $this->loadModel('Page'); $page = $this->Page->findBySlug('klientam'); $this->aNavBar['klientam']['label'] = $page['Page']['title']; $page = $this->Page->findBySlug('onas'); $this->aNavBar['onas']['label'] = $page['Page']['title']; $aFeatured = $this->Product->getRandomRows(3, array('object_type' => 'Product', 'published' => 1, 'featured' => 1)); $this->set('aFeatured', $aFeatured); $this->set('aProductParams', $this->aProductParams); $this->set('aNavBar', $this->aNavBar); $this->set('seo', $this->seo); $this->set('currCat', $this->currCat); }