okhokhar Posted December 1, 2009 Share Posted December 1, 2009 Hi, I'm sort of new to PHP and I had a question about how exactly to structure PHP code. I am building a site to assist in a manufacturing process. The website has multiple different aspect like packaging, shipping, view test results etc... Right now I have created multiple files within each group. For example in the packaging section I have 7 different scripts. Within the packaging section I have been using the action field in a form as well as location.href to jump around the multiple scripts in packaging, so depending on what step of a process the user is in the URL link would be different. However I was recently told that my method is incorrect and I should have one page that controls the access to all other scripts in packaging. As an example I would then have a page called packagingContorl.php and within that file I would have a case statement for each step and then I'd still have the multiple files but packagingControl.php would decide which script to call using include statements. As I'm not familiar with the best coding practices in PHP any help would be appreciated. Also on a side note I have been putting try-catch statements in all my database access classes and if an error pops up I send the error message to the catch block which will print the message out. However, I was told that having too many try-catch statements is also inefficient. Is this correct? Quote Link to comment https://forums.phpfreaks.com/topic/183656-php-code-file-structures/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.