PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have a web page that starts with switch statement that has several cases and each case has one shared function (basically a design template) and it's own unique function. There's a lot of HTML in most of the case parts because I'm dealing with the addition, editing and viewing of a fairly large set of data.
My question: is it better to have all the functions with their html right in my php file (1400+ lines), or should I have an include() for the html pertaining to each function?
The latter would make my main php file shorter, but would it make it faster to process and output?
If there is a performance gain from not including the files, IMHO, it's a) negligible and b)worthwhile to make sure that if anyone ever wants to read your code, they can.
Seperating code (PHP) from presentation (HTML) really is vital, and something oft-overlooked. For more flexibility, you should include those files rather than sticking them in with your PHP.
If you want to go a step further, use templates (e.g. Smarty) for even greater flexibility.