includes or embedded coding?

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!

Moderator: General Moderators

Post Reply
webcornea
Forum Newbie
Posts: 6
Joined: Thu Sep 20, 2007 3:51 pm

includes or embedded coding?

Post by webcornea »

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
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Post by Mordred »

Templates. Most definitely templates. If you want efficient, stay away from homebrew template engines (i.e. don't do it yourself, you're going to make a mess out of it, no offense).
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Very similar thread from today... viewtopic.php?t=73973
webcornea
Forum Newbie
Posts: 6
Joined: Thu Sep 20, 2007 3:51 pm

Post by webcornea »

yea, i am not talking about simple headers/footers. i know they can be common through 1 file.

i am talking about complicated function calls and other php functions. please advise. the first reply was useful but he did not really give pros and cons for each type of coding.

please advise

thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

He shouldn't have to list the pros and cons. Your own research should tell you enough. We aren't here to spoon feed you an answer.

Many template engines (ignoring that PHP is one) can run many native functions, however true templates shouldn't need overly complicated things in them like function calls. They are supposed to be straight forward so they are easily modified. The things filling the data it works with can be as complicated as one wishes however. If the template has to know about the inner workings of things beyond the basics, it probably needs further refinement upstream.
webcornea
Forum Newbie
Posts: 6
Joined: Thu Sep 20, 2007 3:51 pm

Post by webcornea »

feyd wrote:He shouldn't have to list the pros and cons. Your own research should tell you enough. We aren't here to spoon feed you an answer.

Many template engines (ignoring that PHP is one) can run many native functions, however true templates shouldn't need overly complicated things in them like function calls. They are supposed to be straight forward so they are easily modified. The things filling the data it works with can be as complicated as one wishes however. If the template has to know about the inner workings of things beyond the basics, it probably needs further refinement upstream.

if you cannot help then keep your mouth shut.

i am not asking to be spoon fed, simply asking for preferences based on experience.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

webcornea wrote:if you cannot help then keep your mouth shut.

i am not asking to be spoon fed, simply asking for preferences based on experience.
I've provided enough help for you, which you have chosen to ignore because you think it was about headers and footers. Here's a hint: it's not.
Post Reply