i'm trying setup codeigniter (v2.1.4) query strings , having problems passing variables. pages work when controller_trigger , function_trigger passed:
example.org/?c=page&m=index
but when try pass variable:
example.org/?c=page&m=view&id=1
the script throws 'missing argument' , 'undefined variable' errors.
in 'application/config/config.php' i've set:
$config['enable_query_strings'] = true;
in 'application/config/routes.php' have:
$route['default_controller'] = "page";
and controller looks like:
<?php class page extends ci_controller { public function __construct() { parent::__construct(); $this->load->model('page_model'); } public function index() { $data['title'] = 'page title'; $this->load->view('templates/header', $data); $this->load->view('page/page_index', $data); $this->load->view('templates/footer'); } public function view($id) { $data['title'] = 'id page title'; $data['page_item'] = $this->page_model->get_page($id); $this->load->view('templates/header', $data); $this->load->view('page/page_view', $data); $this->load->view('templates/footer'); } }
does know i've missed?
any appreciated
in config.php change:
$config['allow_get_array'] = true; #example.com?who=me&what=something&where=here
Comments
Post a Comment