[eluser]Ayelius Maximous[/eluser]
Hi guys
Forgive me if my English is not well.
Before I start using CI, I used manual url for my project, for example this was one of my url's :
Code:
http://localhost/my-project/admin/settings.php?set=sgmnt&act=add&stp=1/
and in
setteings.php I had codes bellow:
Code:
if($_GET['set'] == 'sgmnt' && $_GET['act'] == 'add' && $_GET['stp'] =='1')
add_segment_stp1();
else if($_GET['set'] == 'sgmnt' && $_GET['act'] == 'add' && $_GET['stp'] =='2'){
add_segment_stp2();
}
and now in CI I need URL's like this one.
In my CI project, I have a controller named Segments.php in location :
application\controllers\Admin
and in controller :
Code:
class Segments extends CI_Controller {
function Lst(){
$data = array(
'title' => "سیستم جامع » پنل مدیریت » لیست مقاطع"
);
$this->load->helper(array('html', 'url', 'date'));
$this->load->model('Admin/Segments_Model');
$this->load->view('Admin/header', $data);
$this->load->view('Admin/Segments/Lst');
$this->load->view('Admin/footer');
}
function add(){
$data = array(
'title' => "سیستم جامع » پنل مدیریت » افزودن مقطع"
);
$this->load->helper(array('html', 'url', 'date', 'form'));
$this->load->model('Admin/Segments_Model');
$this->load->view('Admin/header', $data);
$this->load->view('Admin/Segments/Add');
$this->load->view('Admin/footer');
}
}
So I can use this URL :
Code:
http://localhost/ci/index.php/Admin/Segments/Add
But I need to use sub-segments in Add function like my previous programing method, like switch function that I can define some cases.
like this one:
Code:
http://localhost/ci/index.php/Admin/Segments/Add/1/2
I read CI user guide, but because of my bad English I couldn't understand what should I do?
If you can with example tell me what should I do?