[eluser]solid9[/eluser]
Hi guys
view:
Code:
<div id="navcontainer2" align="center">
<ul>
<li><a href="<?php echo site_url('main/index'); ?>">Home</a></li>
<li><a href="<?php echo site_url('main/menu_selector/post'); ?>">Post a Free Ad</a></li>
<li><a href="<?php echo site_url('main/menu_selector/edit'); ?>">Edit/Delete</a></li>
<li><a href="<?php echo site_url('main/menu_selector/msg'); ?>">Messages</a></li>
</ul>
</div>
controller:
Code:
//redirect to specific page depending on the menu selected by the user.
function menu_selector($str) {
$username = $this->session->userdata('username');
$this->data['header_message'] = '';
$this->data['header'] = $this->load->view('header', $this->data, TRUE);
$this->data['member_menu'] = $this->load->view('member_menu', null, TRUE);
$this->data['midnav'] = $this->load->view('body_m_frontpage', $this->data, TRUE);
$string = uri_string($str);
if($string == "/main/menu_selector/home") { //redirect to index page
//$this->index();
echo 'Home page';
$this->load->view('front_page', $this->data);
} elseif($string == "/main/menu_selector/post") { //redirect to post page
echo 'Post page';
$this->load->view('front_page', $this->data);
} elseif($string == "/main/menu_selector/edit") { //redirect to edit or delete page
echo 'Edit page';
$this->load->view('front_page', $this->data);
} elseif($string == "/main/menu_selector/msg") { //redirect to message/inbox page
echo 'Message page';
$this->load->view('front_page', $this->data);
} else {
}
}
As you can see the view above will produce links.
If you click one of those link it will produce 3 segements URL.
I'm trying to catch the 3 segments url.
Using the uri_string() method to catch the segments,
specially the third segment. coz it is this where
the condition is chosen. Noticed the codes in the controller
that's what I did to catch the 3 segments url.
But The problem is The codes above won't work.
Thanks in advanced.