CodeIgniter Forums
get uri segment for load view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: get uri segment for load view (/showthread.php?tid=50183)



get uri segment for load view - El Forum - 03-17-2012

[eluser]Unknown[/eluser]
dear all i have case about uri segment

my url like this:

Code:
localhost/blog/contact

but i cannot load contact

this my controller:

Code:
$request_page = $this->uri->segment(1);
            if($request_page=='contact'){
                    $this->contact();
            }
    function contact()
     {
                $this->load->view('contact');
     }

how i can be load contact using model like that


get uri segment for load view - El Forum - 03-17-2012

[eluser]InsiteFX[/eluser]
Change to:
Code:
$request_page = $this->uri->segment(2);

uri->segment(1) is your controller!



get uri segment for load view - El Forum - 03-18-2012

[eluser]Unknown[/eluser]
how about if i using function _remap()
any setup for this condition to be running

thx before


get uri segment for load view - El Forum - 03-18-2012

[eluser]InsiteFX[/eluser]
If your use _remap then you need to check for it in your _remap method and then call your contact method.