public function action_index() { $materials = new Model_Material('group'); $gid = $this->request->param('id'); $data = $materials->getTopMaterials($gid, 'time', 1); $this->template->data = $data; }
public function action_index() { $model = array("items" => array()); $this->setopt(array("name" => "catalog_id", "description" => "Ид каталога", "default" => 4)); $materials = new Model_Material('group'); $gid = $this->getopt("catalog_id"); $items = $materials->getTopMaterials($gid, 'views', 4); foreach ($items as $id => $item) { $model["items"][] = array("photo" => $item['photos'][0]['value'], "href" => '/' . $item['node'] . $item['url'] . '.html', "name" => $item['name'], "price" => number_format(Arr::get($item, 'price'), 0, '', ' ')); } $this->set_template("/widgets/w_top.php", "twig")->render($model)->body(); }