HELP with URL

#2
[eluser]Twisted1919[/eluser]
Simple:
Code:
class News extends Controller{

  public function __construct()
  {
    parent::Controller();
  }  

  public function _remap($method)
  {
     if(method_exists($this,$method))
     {
       $this->$method();
     }
     elseif(is_numeric($method) && $method > 0)
     {
       $this->_show_article();
     }
     else
     {
       $this->index();
     }
  }

  public function index()
  {
      //here you extract the data for pagination, the url will be like:
      // index.php/news/index/10
  }

  private function _show_article()
  {
     $article_id=(int)$this->uri->segment(2);
     if(!$data=$this->MODEL->GET_ARTICLE_BY_ID($article_id))
     {
         redirect('news');
     }
     //valid areticle, show it .
  }


}

P.S: esti roman din cate vad, nu? Smile


Messages In This Thread
HELP with URL - by El Forum - 01-07-2011, 01:06 PM
HELP with URL - by El Forum - 01-07-2011, 01:20 PM
HELP with URL - by El Forum - 01-07-2011, 02:54 PM
HELP with URL - by El Forum - 01-07-2011, 03:02 PM
HELP with URL - by El Forum - 01-07-2011, 03:09 PM
HELP with URL - by El Forum - 01-07-2011, 03:29 PM
HELP with URL - by El Forum - 01-07-2011, 03:39 PM
HELP with URL - by El Forum - 01-07-2011, 04:27 PM
HELP with URL - by El Forum - 01-07-2011, 05:57 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.