Welcome Guest, Not a member yet? Register   Sign In
User Guide (Static Page) Documentation Clarification Please
#6

Hello Kuler,

I rember going though this as well, and thought it looked odd, but you have to remember that the provided code below
Quote:In order to load those pages, you’ll have to check whether the requested page actually exists:
is supposed to replace the code currently in the Pages controller:
Code:
       public function view($page = 'home')
       {
       }

So the controller goes from:
Code:
<?php
class Pages extends CI_Controller {

       public function view($page = 'home')
       {
       }
}

to:
Code:
<?php
class Pages extends CI_Controller {

   public function view($page = 'home')
     {
        if ( ! file_exists(APPPATH.'views/pages/'.$page.'.php'))
        {
               // Whoops, we don't have a page for that!
               show_404();
        }

         $data['title'] = ucfirst($page); // Capitalize the first letter

         $this->load->view('templates/header', $data);
        $this->load->view('pages/'.$page, $data);
        $this->load->view('templates/footer', $data);
}
}

:-)
Reply


Messages In This Thread
RE: User Guide (Static Page) Documentation Clarification Please - by Raymien - 09-28-2017, 12:33 PM



Theme © iAndrew 2016 - Forum software by © MyBB