Routes.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php namespace Config;
  2. // Create a new instance of our RouteCollection class.
  3. $routes = Services::routes();
  4. // Load the system's routing file first, so that the app and ENVIRONMENT
  5. // can override as needed.
  6. if (file_exists(SYSTEMPATH . 'Config/Routes.php'))
  7. {
  8. require SYSTEMPATH . 'Config/Routes.php';
  9. }
  10. /**
  11. * --------------------------------------------------------------------
  12. * Router Setup
  13. * --------------------------------------------------------------------
  14. */
  15. $routes->setDefaultNamespace('App\Controllers');
  16. $routes->setDefaultController('Home');
  17. $routes->setDefaultMethod('index');
  18. $routes->setTranslateURIDashes(false);
  19. $routes->set404Override();
  20. $routes->setAutoRoute(false);
  21. //i chnaged above after reading foundation book
  22. //$routes->setAutoRoute(true);
  23. /**
  24. * --------------------------------------------------------------------
  25. * Route Definitions
  26. * --------------------------------------------------------------------
  27. */
  28. // We get a performance increase by specifying the default
  29. // route since we don't have to scan directories.
  30. /*-------my setup below---*/
  31. /*
  32. * domain/setUp brings up form to populate db for a user and their password
  33. * when done come back here and comment out the 2 lines below :
  34. * i.e $routes->get('setUp','Setup::setUpForm');
  35. * $routes->post('setUpDo','Setup::process');
  36. *
  37. */
  38. $routes->get('setUp','Setup::setUpForm');
  39. $routes->post('setUpDo','Setup::process');
  40. $routes->get('/', 'Home::index');
  41. $routes->get('addProduct','Product::productAddForm');
  42. $routes->post('addProduct','Product::addProductDo');
  43. $routes->get('showProducts','Product::getProducts');
  44. $routes->get('productCat/productInfo/(:segment)', 'Product::prodInfo/$1');
  45. $routes->get('editProducts','Product::displayProdsToEdit');
  46. $routes->get('editOneProduct/(:segment)','Product::editOneProduct/$1');
  47. $routes->post('editProductDo','Product::processEditProduct');
  48. $routes->get('removeProduct','Product::delProdForm');
  49. $routes->post('delProduct','Product::delProductDo');
  50. $routes->get('productCat/(:segment)','Product::getCategory/$1');
  51. /* ----- gallery ----------------------- */
  52. $routes->get('showGallery','Gallery::countGallery');
  53. $routes->get('countGallery','Gallery::countGallery');
  54. $routes->get('displayGallery','Gallery::displayGallery');
  55. $routes->get('addGallery','Gallery::galleryAddForm');
  56. $routes->post('addGallery','Gallery::addGalleryDo');
  57. $routes->get('delGallery','Gallery::delGalleryForm');
  58. $routes->post('delGallery','Gallery::delGalleryDo');
  59. /* ------------------------------------------------- */
  60. /*-------------blog----------------------------------*/
  61. $routes->get('dependencyInjection','Blog::altMethod');
  62. $routes->get('newblog', 'Blog::blogForm');
  63. $routes->get('editBlogs','Blog::editBlogForm');
  64. $routes->get('editOneBlog/(:segment)','Blog::editBlog/$1');
  65. $routes->post('doEditBlog','Blog::processEditBlog');
  66. $routes->post('newblog','Blog::newBlogArticle');
  67. $routes->get('removeBlog','Blog::delBlogForm');
  68. $routes->post('delBlog','Blog::delBlog');
  69. $routes->get('blogs','Blog::doPaginate');
  70. $routes->get('blogArticle/(:segment)', 'Blog::showArticle/$1');
  71. $routes->get('linkPdf/(:segment)','ProducePDF::getPdf/$1');
  72. /*------------------------------------------------*/
  73. /*--------------------login, admin----------------*/
  74. $routes->get('admin','Login::admin');
  75. /*line below defines login url for domain i.e domain/orange */
  76. $routes->get('orange','Login::login');
  77. $routes->post('login','Login::credentials');
  78. $routes->get('logout','Login::logout');
  79. /*-------------------------------------*/
  80. $routes->post('contact','Sendmail::processform');
  81. $routes->get('spam','Spam::spam');
  82. $routes->get('noPage','Pages::nopage');
  83. $routes->get('(:any)', 'Pages::showme/$1');
  84. /**
  85. * --------------------------------------------------------------------
  86. * Additional Routing
  87. * --------------------------------------------------------------------
  88. *
  89. * There will often be times that you need additional routing and you
  90. * need it to be able to override any defaults in this file. Environment
  91. * based routes is one such time. require() additional route files here
  92. * to make that happen.
  93. *
  94. * You will have access to the $routes object within that file without
  95. * needing to reload it.
  96. */
  97. if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php'))
  98. {
  99. require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
  100. }