Routes.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. //$routes->get('setUp','Setup::setUpForm');
  32. //$routes->post('setUpDo','Setup::process');
  33. //$routes->get('printing','Attachment::showForm');
  34. //$routes->post('attachDo','Attachment::process');
  35. $routes->get('/', 'Home::index');
  36. $routes->get('test','Home::test');
  37. /*---------new products-----------------form,controller,models--*/
  38. $routes->get('addProduct','Product::productAddForm');
  39. $routes->post('addProduct','Product::addProductDo');
  40. $routes->get('showProducts','Product::getProducts');
  41. $routes->get('productCat/productInfo/(:segment)', 'Product::prodInfo/$1');
  42. $routes->get('editProducts','Product::displayProdsToEdit');
  43. $routes->get('editOneProduct/(:segment)','Product::editOneProduct/$1');
  44. $routes->post('editProductDo','Product::processEditProduct');
  45. $routes->get('removeProduct','Product::delProdForm');
  46. $routes->post('delProduct','Product::delProductDo');
  47. $routes->get('productCat/(:segment)','Product::getCategory/$1');
  48. /* ----- gallery ----------------------- */
  49. $routes->get('showGallery','Gallery::countGallery');
  50. $routes->get('countGallery','Gallery::countGallery');
  51. $routes->get('displayGallery','Gallery::displayGallery');
  52. $routes->get('addGallery','Gallery::galleryAddForm');
  53. $routes->post('addGallery','Gallery::addGalleryDo');
  54. $routes->get('delGallery','Gallery::delGalleryForm');
  55. $routes->post('delGallery','Gallery::delGalleryDo');
  56. /* ------------------------------------------------- */
  57. /*-------------blog----------------------------------*/
  58. $routes->get('dependencyInjection','Blog::altMethod');
  59. $routes->get('newblog', 'Blog::blogForm');
  60. $routes->get('editBlogs','Blog::editBlogForm');
  61. $routes->get('editOneBlog/(:segment)','Blog::editBlog/$1');
  62. $routes->post('doEditBlog','Blog::processEditBlog');
  63. $routes->post('newblog','Blog::newBlogArticle');
  64. $routes->get('removeBlog','Blog::delBlogForm');
  65. $routes->post('delBlog','Blog::delBlog');
  66. $routes->get('blogs','Blog::doPaginate');
  67. $routes->get('blogArticle/(:segment)', 'Blog::showArticle/$1');
  68. $routes->get('linkPdf/(:segment)','ProducePDF::getPdf/$1');
  69. /*------------------------------------------------*/
  70. /*--------------------login, admin----------------*/
  71. $routes->get('admin','Login::admin');
  72. $routes->get('blackcat','Login::login');
  73. $routes->post('login','Login::credentials');
  74. $routes->get('logout','Login::logout');
  75. /*-------------------------------------*/
  76. $routes->post('contact','Sendmail::processform');
  77. $routes->get('spam','Spam::spam');
  78. $routes->get('noPage','Pages::nopage');
  79. $routes->get('(:any)', 'Pages::showme/$1');
  80. /**
  81. * --------------------------------------------------------------------
  82. * Additional Routing
  83. * --------------------------------------------------------------------
  84. *
  85. * There will often be times that you need additional routing and you
  86. * need it to be able to override any defaults in this file. Environment
  87. * based routes is one such time. require() additional route files here
  88. * to make that happen.
  89. *
  90. * You will have access to the $routes object within that file without
  91. * needing to reload it.
  92. */
  93. if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php'))
  94. {
  95. require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
  96. }