Hiya! , I've been thinking long and hard about the best way to structure the code for a project I'm currently working on, to allow for easy development and management. Upon carrying out a search on the internet relating to this subject, it has been mentioned more than once, that it is a good idea to separate presentation code from logic (e.g. HTML from PHP) I am keen to obtain a better understanding on how you guys would code a simple page that displays information from a database and requires some sort of user input, whilst allowing for error messages to be displayed, if the user incorrectly completes what was asked of them. Also, I'm currently looking into the best way to link different pages together within my application. I've checked out some forum software (phpBB, myBB and smf) for inspiration and they all tend to link to different pages of the website via a main index.php file, containing a switch statement. Is this the best way, or are there other techniques that could be used? - What are the advantages/disadvantages of this approach? Of course, choosing the best structure to use at the beginning of a project is highly important, as this will then need to be adopted throughout the application. If you could provide examples of code or point me in the right direction, it would be much appreciated. Many Thanks, FishSword
Hi Jazzcho, Thanks for your reply. What happens when you create a pagination script for example? You will then be mixing HTML with the PHP. Whilst looking at the "A very basic MVC example (WARNING - PHP Inside)" example shown on the website you provided the link for, how would you display any error messages to the user if the page asked for user input, and the user completed the fields incorrectly? Also, how would each of the pages be linked together? Using a switch statement in an index.php file? Is this the best solution, or can this be achieved some other way? Cheers for you help! Many Thanks, FishSword