Exemplo n.º 1
0
 private function show()
 {
     $this->showNav();
     $article = new articleModel();
     $nav = new navModel();
     if ($_GET['id'] && !empty($_GET['id'])) {
         $nav->id = $_GET['id'];
         $oneNav = $nav->getOneNav();
         $this->smarty->assign("oneNav", $oneNav);
         $allSubNav = $nav->getAllSubNavById();
         //Tools::dump($oneNav);
         $arr = array();
         foreach ($allSubNav as $value) {
             //Tools::dump($value);
             $article->nid = $value->id;
             //echo $article->nid."<br>";
             //$arr[$value->name][]=$article->getSubNavArticle();
             $arr[$value->name][] = $article->getArticleByNID();
         }
         //Tools::dump($arr);
         $this->smarty->assign("articles", $arr);
         $this->smarty->assign("allSubNav", $allSubNav);
     } else {
         header("Location:index.php");
     }
 }
Exemplo n.º 2
0
 private function nav($num = 0)
 {
     $nav = new navModel();
     //Tools::dump($nav->getAllMainNav());
     $str = null;
     foreach ($nav->getAllMainNav() as $value) {
         $nav->id = $value->id;
         $subNav = $nav->getAllSubNavById();
         $str .= "<optgroup label='" . $value->name . "'>";
         $selected = null;
         foreach ($subNav as $v) {
             if ($num == $v->id) {
                 $selected = "selected='selected'";
             } else {
                 $selected = "";
             }
             $str .= "<option value='" . $v->id . "' " . $selected . ">" . $v->name . "</option>";
         }
         $str .= "<optgroup>";
     }
     $this->smarty->assign("nav", $str);
 }