Welcome Guest, Not a member yet? Register   Sign In
HELP with URL
#6

[eluser]Evollution[/eluser]
MY code
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class News extends CI_Controller {

    function __construct()
    {
        parent::__construct();
        $this->load->model('news_model');
        
    }
public function _remap($method)
  {
     if(method_exists($this,$method))
     {
       $this->$method();
     }
     elseif(is_numeric($method) && $method > 0)
     {
       $this->_show_article();
     }
     else
     {
       $this->index();
     }
  }

     //paginarea ..
    
    function index()
    {
        $data = array();
    
        $this->load->library('pagination');
        $config['base_url'] = 'http://www.fifago.com/demo2/index.php/news/index';
        $config['total_rows'] = $this->db->get('news')->num_rows();
        $config['per_page'] = 10;
        $config['num_links'] = 20;

        $this->pagination->initialize($config);

        $this->load->helper('form');    

            if($query = $this->news_model->get_last_ten_entries())
    {
            $data['records'] = $query;
    }    
            $this->load->view('news_view', $data);    


    }

     // noutatile in functie de id

  private function _show_article()
  {
     $article_id=(int)$this->uri->segment(2);
     if(!$data=$this->MODEL->GET_ARTICLE_BY_ID($article_id))
     {
         redirect('news');
     }
  }


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



Theme © iAndrew 2016 - Forum software by © MyBB