Alternative to uri segment on codeigniter? -
im getting id form using
$id=$this->uri->segment(2)
i need replace else generic without getting id url im using pagination in several pages & im using
$this->uri->segment()
too ..
ps:when want display list o programs belong category & when want display list of programs of channel belong category ,the segment change wont use segment wanna id dynamically ..
best regards
don't know if after, can send parameters in standard codeigniter install uri , catch them in method params.
class welcome extends my_controller { public function index($a = null, $b = null, $c= null) { echo 'testing params: <br> param1: ' . $a . '<br>param2: ' . $b . '<br>param3: ' . $c; } }
calling http://example.com/index.php/welcome/index/test1/test2/test3
render
testing params: param1: test1 param2: test2 param3: test3
example
going comment code:
foreach $rows $row .. .. id; ?>" href="program/details_program/id; ?>"> program_title; ?> page detail.php $id = $this->uri->segment(2); $query = $this->db->get_where('programs', array('id' => $id));
it looks have program
controller details_program
method linking , want different solution uri->segment
. if case, work url http://example.com/program/program_details/123
:
class program extends ci_controller{ function program_details($id = null){ $query = $this->db->get_where('programs', array('id' => $id)); } }
if isn't want, please update question of relevant (properly formatted) code