Welcome Guest, Not a member yet? Register   Sign In
Creating a simple view help?
#3

[eluser]Haley[/eluser]
Ok so in my routes, I have:
Code:
$route['forms/(:any)'] = 'user/view/$1';
$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';

No the URL is site.com/forms/register, but I want it to appear like site.com/register

I changed the controller to this:
Code:
<?php

class User extends CI_Controller {
public function __construct() {
  parent::__construct();
  $this->load->model('User_model','User');
}
public function view($page = 'home')
{  
  if ( ! file_exists('application/views/forms/'.$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('forms/'.$page, $data);
  $this->load->view('templates/footer', $data);

}
}
?>

Still won't work.


Messages In This Thread
Creating a simple view help? - by El Forum - 02-01-2012, 06:30 AM
Creating a simple view help? - by El Forum - 02-01-2012, 06:39 AM
Creating a simple view help? - by El Forum - 02-01-2012, 07:04 AM
Creating a simple view help? - by El Forum - 02-01-2012, 07:19 AM
Creating a simple view help? - by El Forum - 02-01-2012, 07:28 AM
Creating a simple view help? - by El Forum - 02-01-2012, 07:41 AM
Creating a simple view help? - by El Forum - 02-01-2012, 07:48 AM
Creating a simple view help? - by El Forum - 02-01-2012, 08:25 AM
Creating a simple view help? - by El Forum - 02-01-2012, 08:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB