I’ve been coding a website for the past 6 months using HTML/CSS/PHP/MySQL/Javascript. I’m coding all independently and finding it hard to interact with all of these technologies.
For instance, I have been writing PHP code to echo HTML output. I find this very messy and hard to maintain. Also, I’m finding myself doing redundant database calls because I don’t have an easy way to call once and distribute the information to multiple other technologies (e.g. Javascript and PHP). These are just a few things that have caused me trouble.
From a very high-level, are there some approaches or design patterns that are used to make this process easier and more elegant? Any books or frameworks that someone could recommend?
I assume this can be done in a cleaner way. Thanks!
One of the most common web development paradigms is called MVC — “Model, View, Controller”. Using this approach you separate the various concerns of your page very well. Models handle the business logic of your application, controllers handle the web interaction, and views handle the output to the user. One popular PHP MVC framework is CakePHP.