kigroy Posted December 14, 2008 Share Posted December 14, 2008 Question about coding practice: Is it better to separate your php code from your html unless you need the php code to generate a variable amount of html code (i.e. using a loop command to create rows or columns on a table)? or to have the entire page created by php? The reason I ask is I was trying to code with php creating all the html code when I was discussing something with a programmer and he said to NEVER do that. That it only creates confusion and only should be done when you are dealing with a variable amount of columns or rows in a table. Thoughts? BTW, I was using php to create all code based off some examples I found here at phpfreak.com. Link to comment https://forums.phpfreaks.com/topic/136944-good-coding-practice/ Share on other sites More sharing options...
genericnumber1 Posted December 14, 2008 Share Posted December 14, 2008 For large applications, it's often best practice to separate logic from presentation, yes. Often template engines (such as the one built into the majority of frameworks) are used to do just that. When it really gets down to it for large applications, I will often use an MVC framework such as Zend to simplify the separation. For small, run-occasionally applications? Meh, why bother. Link to comment https://forums.phpfreaks.com/topic/136944-good-coding-practice/#findComment-715293 Share on other sites More sharing options...
kigroy Posted December 14, 2008 Author Share Posted December 14, 2008 Thanks for the explanation. I will aspire to that format. Link to comment https://forums.phpfreaks.com/topic/136944-good-coding-practice/#findComment-715297 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.