newbie question concerning style
Posted: Thu Feb 11, 2010 9:40 pm
Hi,
I am new to php and to this forum also. I hope I have this topic in the correct forum. I thought it might also be a candidate for PHP - Theory and Design because this is a question concerning style but as I don't really know much about PHP I guess it should be here.
I have a background in C, C++, C#, Perl, Python, but not really in PHP. The syntax appears to be similar to Perl in places. So I am trying to teach myself PHP but there is only so much one can gain from a tutorial on PHP syntax.
I have looked at the PHP code for a bulletin board (quite a well known one on the web) and was surprised to see that there are no templates. Pretty much all the template code is ejected from echo statements. I imagine if one is going to create templates that way it would render most WYSIWIG html page editors practically useless. Yet I think I have seen html templates before that allow embedding of php code in them. To complicate matters further I imagine that would make it more difficult to submit the html code to online html validators. I know I am pretty adept at creating awful html if left to my own devices.
So here is the question. What is best practice for php? Are there any? And is it considered normal to eject html from within php echo statements for all of the project templates?? Does anyone have any opinions on this?
Your insight appreciated. Thanks.
Kiwi_NZ
I am new to php and to this forum also. I hope I have this topic in the correct forum. I thought it might also be a candidate for PHP - Theory and Design because this is a question concerning style but as I don't really know much about PHP I guess it should be here.
I have a background in C, C++, C#, Perl, Python, but not really in PHP. The syntax appears to be similar to Perl in places. So I am trying to teach myself PHP but there is only so much one can gain from a tutorial on PHP syntax.
I have looked at the PHP code for a bulletin board (quite a well known one on the web) and was surprised to see that there are no templates. Pretty much all the template code is ejected from echo statements. I imagine if one is going to create templates that way it would render most WYSIWIG html page editors practically useless. Yet I think I have seen html templates before that allow embedding of php code in them. To complicate matters further I imagine that would make it more difficult to submit the html code to online html validators. I know I am pretty adept at creating awful html if left to my own devices.
So here is the question. What is best practice for php? Are there any? And is it considered normal to eject html from within php echo statements for all of the project templates?? Does anyone have any opinions on this?
Your insight appreciated. Thanks.
Kiwi_NZ