Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have been unsuccessful with getting a static .php page to run on my local wamp server.

Here are my steps according to code igniter:
1. Unzip the package.
2. Copy the CodeIgniter folders and files to my local server directory
3. Go into the application folder of code igniter ( application/config/config.php)and set my base url to http://cns_projects.com using notepad++

4. I create a file named pages.php at application/controllers/pages.php in the code igniter folder with the following code
PHP
<?php
             class Pages extends CI_Controller {

    public function view($page = 'home')
    {
      if (!file_exists('application/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);

}


5. I create a header.php file in the code igniter folder at application/views/templates/header.php with following code:

HTML
<html>
<head>
	<title><?php echo $title ?> - CodeIgniter 2 Tutorial</title>
</head>
<body>
	<h1>CodeIgniter 2 Tutorial</h1>


6. Create the footer in the same template folder located in the code igniter folder at application/views/templates/footer.php
HTML
© 2011	
</body>
</html>


7. I entered in my web address: http://cns_projects.com/index.php/pages/view/ to see a page I created called home.php.
I got a message which says access is forbidden. Error 403.


What is I have done wrong in setting up Code Igniter so that when I create my .php file in the view I'm able to enter the url to access it.

Any help would be much appreciated. Thanks much.

Wayten
Posted
Updated 5-Mar-12 8:31am
v2

1 solution

This[^] may help you
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900