Welcome Guest, Not a member yet? Register   Sign In
Working with URI, getting a wrong view..
#1

[eluser]pstp[/eluser]
As the tittle, I work with uri, and the browser said that page not found.
This is my controller, lab.php:
Code:
function index()
    {    
        $id=$this->uri->segment(2);
        $new_data['new_data']= $this->profile_model->is_profile($id);
            
        if ($new_data)//if there is profile with id= session_id, load profile_view (see the query in Profile_model)
        {    
            $data['data']=array(
            'main_content'=>'profile/profile_view',
            'new_data'=>$new_data,
            );
            $this->load->view('include/template', $data);
        }
        else
        {
            $this->create_profile();
        }
        
    }

I have made a view named profile_view.php, also the profile_model. The browser shows Page not found for the url: http://localhost/kokko/lab/1 (1 here is the 2nd segment).
What happened here guys??
#2

[eluser]WanWizard[/eluser]
If you get "page not found", your controller can not be located.

I assume CI is installed in the subdirectory 'kokko' of your webservers document root? Are your rewrite rules setup properly? Any routing rules that might interfere?
#3

[eluser]pstp[/eluser]
No Wan, my CI is installed in Kokko, so Kokko's past name is CI..

Is URI routing can't be after the class? localhost/kokko/lab/1-> lab is a classname.. What should I do best?
#4

[eluser]WanWizard[/eluser]
That's what I said.

Are you getting a 404 not found error from your webserver? If so, then your rewritting is probably at fault. If your getting a "page not found" error from CodeIgniter, it can't find a controller to load.

This could also be because a CI url should have /controller/method/parameters. With your URL, it looks for a method called '1', with obviously doesn't exist. Either add the method to your URL, or use the _remap() method.
#5

[eluser]pstp[/eluser]
Sorry for my technical understanding..

So, how about remap() function?
I confused with remap. On example I have, the remap called after index() function, then no other function/method after the remap() function. Or is it because a class that has remap() can not have another function? For example, in my case I have localhost/kokko/lab/1, if I use remap(), means the segmen after lab can only be the id? and because of that, we can't have other method after lab?




Theme © iAndrew 2016 - Forum software by © MyBB