I have this PHP code argument
switch ($parts[count($parts) - 1]) { case 'restaurant_pos': include($_SERVER['DOCUMENT_ROOT'] . '/pages/restaurant_pos.php'); break; case 'retail_pos': include($_SERVER['DOCUMENT_ROOT'] . '/pages/retail_pos.php'); break; ..... }
Which works fine, but I have a lot of files (e.g. 190), and I would be interested to know if there is a way to get this thing to work a lot with something, so I do not need to do 190 cases. I thought I could use condtion in this case and maybe see if this file is present, and if so, display it, and if not, then maybe page 404, but I was not sure if this is a good way ... any ideas will help a lot
directory loops php switch-statement
Trace
source share