2
I am restarting my studies in the area of IT and I have this doubt. In the course I’m doing the examples show the php code mixed and inserted into the html code. Is that really how it works in practice? I have a flea behind my ear telling me that this is not good practice. If so, how do the back and front developers share the code?
My question is not to know what Front and Back is, is to understand why the php code is together with the html. If they do it even in the day-to-day of the companies.
Do you really want to know at PHP or language independent level? Back and front can also be applied in other contexts, such as mobile or even desktop.
– Jefferson Quesado
I believe that for my level would further elucidate the question of knowing the level of php
– Roberto Cruz Neto
Have a
foreach
or even aif
simple within html tags has no problem. The real problem is that giant 1200 script with business logic, presentation and who knows what else.– rray
In some cases you will notice that merging PHP code with HTML can help you. But as @rray said, the problem is in excess. In wanting to transfer class responsibilities to your PHP page that contains HTML and turn it into a giant, hard-to-understand file. I particularly prefer to separate the maximum and make the interactions of PHP pages with HTML templates via javascript. But this is not a rule and you can choose what is best for you or your project!
– alan