php - Codeigniter routes with arguments -
i want wont work, means doing wrong.
$route['print/:num'] = "user/doprint/goprint/:num";
let me explain. have controller doprint
under user
folder , goprint
method inside doprint
accepts id
argument. dont want users visit mydomain.com/user/doprint/goprint/2
. want them visit mydomain.com/print/2
.
my controller below
class doprint extends user_controller { public function index() { $data['subview'] = 'print'; $this->load->view('main_layout', $data); } public function goprint($id=null) { $data['model'] = $this->usermodel_model->get($id); $data['subview'] = 'print'; $this->load->view('main_layout', $data); } }
the route rule syntax (per documentation):
$route['print/(:num)'] = "user/doprint/goprint/$1";
Comments
Post a Comment