Jump to content

includes or embedded coding?


webcornea

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.