Esempio n. 1
0
 public function showOthers($type, $id)
 {
     $url = new FunctionController();
     if ($url->isURL($type)) {
         $contacts = Contact::Select();
         $news = TinTuc::getANews($id, $url->getID($type));
         $title = $url->switchName($type);
         $title .= $news == null ? " || Lỗi" : " || " . $news->tieude;
         //bv cung chuyen muc
         $threads = TinTuc::SelectRelate("same", $id, $url->getID($type), 3);
         //ajax pagingation cung chuyen muc
         $bv['noidung'] = $threads;
         $bv['phantrang'] = $threads->links();
         if (Request::ajax() && Input::get("type") == "cungchuyenmuc") {
             $html = View::make("guest.relations.ajaxpagination_same", $bv)->render();
             return Response::json(array('html' => $html));
         }
         //end ajax pagingation cung chuyen muc
         //bv moi nhat
         $newthreads = TinTuc::SelectRelate("new", $id, null, 5);
         //ajax pagingation bv moi nhat
         $bvm['noidung'] = $newthreads;
         $bvm['phantrang'] = $newthreads->links();
         if (Request::ajax() && Input::get("type") == "baivietmoi") {
             $html = View::make("guest.relations.ajaxpagination_new", $bvm)->render();
             return Response::json(array('html' => $html));
         }
         //end ajax pagingation bv moi nhat
         //bv xem nhieu
         $viewsthreads = TinTuc::SelectRelate("views", $id, null, 5);
         //ajax pagingation bv xem nhieu
         $xemnhieu['noidung'] = $viewsthreads;
         $xemnhieu['phantrang'] = $viewsthreads->links();
         if (Request::ajax() && Input::get("type") == "xemnhieu") {
             $html = View::make("guest.relations.ajaxpagination_views", $xemnhieu)->render();
             return Response::json(array('html' => $html));
         }
         //end ajax pagingation bv xem nhieu
         return View::make('guest.news.view')->with('contacts', $contacts)->with('news', $news)->with('threads', $threads)->with('newthreads', $newthreads)->with('viewsthreads', $viewsthreads)->with("title", $title);
     } else {
         return $this->index();
     }
 }