コード例 #1
0
 public function getbannerAction()
 {
     global $banner_ar;
     require_once APPLICATION_PATH . '/utils/sportlandia.php';
     if ($this->getRequest()->isGet()) {
         $mycat_banner = $this->_getParam('mycat');
         $cnt = count($banner_ar);
         $c_ar = $banner_ar[rand(0, $cnt - 1)];
         $db = new Application_Model_DbTable_Products();
         $db2 = new Application_Model_DbTable_Categories();
         $first_name = $db2->getCategoryById($c_ar['cat']);
         $first_name = $first_name[0]['name'];
         $second_name = "";
         $prod_cat = $c_ar['cat'];
         if ($c_ar['subcat'] != 0) {
             $second_name = $db2->getCategoryById($c_ar['subcat']);
             $second_name = $second_name[0]['name'];
             $prod_cat = $c_ar['subcat'];
         }
         $ctop = sportlandia_getTopCat($prod_cat);
         $section = sportlandia_getSection($ctop);
         $prod = $db->getBannerProduct($prod_cat, $mycat_banner);
         $this->view->pic = $prod[0]['pic'];
         $this->view->price = $prod[0]['pprice'];
         $this->view->first = $first_name;
         $this->view->second = $second_name;
         $this->view->section = $section;
         $this->view->cat = $prod_cat;
         $out = $this->view->render("products/banner.phtml");
         echo iconv('windows-1251', 'utf-8', $out);
         exit;
     }
 }