webcornea Posted September 20, 2007 Share Posted September 20, 2007 hello, i am a programmer but i have never coded in PHP. I am building a PHP based site with thousands of pages through a friend who claims to be proficient in PHP. Anyway, he is suggesting that we embed PHP code within the HTML files but I have heard that it is better to keep HTML and PHP functions separate. Please advise which method is better for coding and any input you guys can give will be great. We just want to be build an efficient site that we can easily update the design and code. Thank you Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 20, 2007 Share Posted September 20, 2007 I don't see how it's possible not to mix the two. The HTML is for formatting, and the PHP is for the sites function. If you have to organize your data that comes from PHP into a table, what are you going to do, include a file that opens your table, then include another file that closes it? It wouldn't make sense not to mix them. You could have a PHP class that calls the HTML, then whenever you want to edit the HTML you just go into the class and edit it. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 He is asking about using a templating system like smarty, as opposed to just having html in the PHP code. While most people would say you should use a templating system, I feel they often make things more complicated than they need to be and say screw it on most projects. I think it becomes personal preference. As long as everything is neat and organized, you don't NEED a template system to write good code. If it helps you, use it. Quote Link to comment Share on other sites More sharing options...
webcornea Posted September 20, 2007 Author Share Posted September 20, 2007 so i guess there are no better or worse way of doing things? it is just a matter of preference? Quote Link to comment Share on other sites More sharing options...
MmmVomit Posted September 20, 2007 Share Posted September 20, 2007 It depends on what you're doing. If this is something you're going to release as a downloadable package, templating would probably be good. If this is a small scale proprietary site, templating may be more trouble than it's worth. Quote Link to comment 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.