Guest User

Untitled

a guest
Jan 15th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. $route['default_controller'] = "pages/view";
  2. $route['dev/(:any)'] = "dev/pages/view/$1";
  3. $route['404_override'] = '';
  4.  
  5. <?php
  6. class Pages extends CI_Controller
  7. {
  8. public function view($page = 'home')
  9. {
  10. if (!file_exists('application/views/pages/' . $page . '.php'))
  11. {
  12. // Whoops, we don't have a page for that!
  13. show_404();
  14. }
  15.  
  16. $data['title'] = ucfirst($page); // Capitalize the first letter
  17.  
  18. $this->load->view('templates/header', $data);
  19. $this->load->view('pages/' . $page);
  20. $this->load->view('templates/footer');
  21. }
  22. }
  23. ?>
  24.  
  25. <IfModule mod_rewrite.c>
  26. RewriteEngine On
  27. RewriteBase /dev/
  28.  
  29. #Removes access to the system folder by users.
  30. #Additionally this will allow you to create a System.php controller,
  31. #previously this would not have been possible.
  32. #'system' can be replaced if you have renamed your system folder.
  33. RewriteCond %{REQUEST_URI} ^system.*
  34. RewriteRule ^(.*)$ /index.php?/$1 [L]
  35.  
  36. #When your application folder isn't in the system folder
  37. #This snippet prevents user access to the application folder
  38. #Submitted by: Fabdrol
  39. #Rename 'application' to your applications folder name.
  40. RewriteCond %{REQUEST_URI} ^application.*
  41. RewriteRule ^(.*)$ /index.php?/$1 [L]
  42.  
  43. #Checks to see if the user is attempting to access a valid file,
  44. #such as an image or css document, if this isn't true it sends the
  45. #request to index.php
  46. RewriteCond %{REQUEST_FILENAME} !-f
  47. RewriteCond %{REQUEST_FILENAME} !-d
  48. RewriteRule ^(.*)$ index.php?/$1 [L]
  49. </IfModule>
  50.  
  51. <IfModule !mod_rewrite.c>
  52. # If we don't have mod_rewrite installed, all 404's
  53. # can be sent to index.php, and everything works as normal.
  54. # Submitted by: ElliotHaughin
  55.  
  56. ErrorDocument 404 /index.php
  57. </IfModule>
  58.  
  59. <?php
  60. class Aboutus extends CI_Controller{
  61. function __construct(){
  62. parent::__construct();
  63. }
  64.  
  65. function index(){
  66. "I'm in the about controller!";
  67. //$this->load->view("some_view") ;
  68. }
  69. }
Add Comment
Please, Sign In to add comment