function renderDefault() { $key = 'category_info_' . $this->template->id_category; $this->template->category = CategoryModel::getCache($key); if (!$this->template->category) { $this->template->category = CategoryModel::getFluent()->where('id_category = %i', $this->template->id_category)->fetch(); CategoryModel::setCache($key, $this->template->category); } /* * META INFO */ $this['header']->addTitle($this->template->category['meta_title']); $this['header']->setDescription($this->template->category['meta_description']); $this['header']->addKeywords($this->template->category['meta_keywords']); }
function render() { $template = $this->template; $template->setFile(dirname(__FILE__) . '/default.phtml'); $template->langs = Setting::getLangs(); switch ($this->mode) { case 'edit': $id_category = $this->getPresenter()->getParam('id_category'); $this['baseForm']->addSubmit('btn', 'Upraviť'); $this['baseForm']['id_category']->setValue($id_category); $values = array(); foreach ($template->langs as $l) { $val = CategoryModel::getFluent()->where('id_lang = %i', $l['id_lang'], 'AND id_category=%i', $id_category)->fetch(); $values += array('name' . self::$_separator . $l['iso'] => $val['name'], 'description' . self::$_separator . $l['iso'] => $val['description'], 'link_rewrite' . self::$_separator . $l['iso'] => $val['link_rewrite'], 'meta_title' . self::$_separator . $l['iso'] => $val['meta_title'], 'meta_description' . self::$_separator . $l['iso'] => $val['meta_description'], 'id_parent' => $val['id_parent'], 'show_on_bottom' => $val['show_on_bottom'], 'active' => $val['active']); } //print_r($values); $this['baseForm']->setDefaults($values); break; default: $this['baseForm']->addSubmit('btn', 'Pridat'); break; } $template->render(); }