ADM
ADM

Reputation: 1610

CodeIgniter: show a view by typing its url

A newbie here: sorry if the question is too simple, been looking in tutorials but I don't seem to look properly.

I have the

$route['default_controller'] = "mainpage";

in routes.php working properly, and now I just want to view one of the php pages in views folder by typing its url:

http://myserver/folder/thepageIwantToSee

I get a 404 Not Found error. Do I have to use a controller? I just want to see it first before any linking, is there a way to do it?

Thanks a lot!

Upvotes: 0

Views: 129

Answers (2)

sdot257
sdot257

Reputation: 10376

class yourcontroller extends CI_Controller {

     function pageiwanttosee()
     {
         code
         code

         $this->load->view('the_view_page', $data);
     }

 }

Upvotes: 2

Karoly Horvath
Karoly Horvath

Reputation: 96306

Yes, you can write a controller that displays the view specified.

http://myserver/showfile/folder/thepageIwantToSee , where showfile is your controller.

Don't forget to set some security check or disable this on production site.

Upvotes: 0

Related Questions