I just want some clarification on how the pages for the app should be designed and in which pages exactly the code should be located?
In the tut letter it is specified:
"Note that you only have 4 admin pages, therefore all code related to managing the course (MC1 -> MC2) must fit in course_man.php. It follows that you must make use of if/else or case to manage how code is handled."
I for example have designed my application as follows:
course_man.php presents a list of courses with links to add, edit or delete. Clicking on one of the links take the user to a different php page where the info relating to the action is inserted (for example course_update.php). The actual update or delete in the database then occurs in this page.
Is this acceptable or is it critical that all the code relating to managing the courses be located inside course_man.php? This would then imply that we must have one php page generating different forms depending on what link is clicked? It does complicate things a bit...
Thx for the reply. I was wondering what options there are available to make sure that everything is still kept rather simple, easily readable and understandable. Especially in terms of troubleshooting. Having 1 page with so much info on means it can become a bit of a mess. Obviously making use of includes and as much as possible functions is supposed to be priority in order to achieve the aforementioned.
In terms of writing the page so that different html get's generated based on what input the user gives. The aforementioned would imply a lot of html inside a PHP section. As far as I am aware there are only 2 options to do this. Either printing out each html line or using the heredoc syntax.
Heredoc syntax is nice but is required to be right to the left of the page. This results in code unneatness. Even printing every html line provides for a lot of unnecessary code.
I would just like your and some of the other guys opinion on this. What strategy do you guys follow to keep your code neat and logical?
I was actually wrestling with the same question, should I spread the code across many pages, therefore less & more purpose specific code in a few pages or do it in as little possible pages with conditional statements. I initially had quite a few pages but have since cut down. Thank you for the tips Mac & for all your support thus far, we all appreciate it!