Jump to content

Which is better: .php in an .html page, or .html in a .php page?


Mavent

Recommended Posts

I build almost all my pages in .html and then do my .php calls inside the .html code.  A buddy of mine who's also a web developer told me that I'm doing it backwards, and I should be building .php pages and calling .html inside of them.  I'm interested in knowing which of us is full of crap.

 

My argument is that it's insanely hard to write .html code inside a .php page. (For me, anyway).  Half the time, the page just pops up completely blank, and I have yet to figure out what Magic Word I'm using on the 50% of the time that it actually works.  :)

 

Opinions?  Thoughts?  Insults?  I'm open to all comments...

Link to comment
Share on other sites

If you're the only coder, than whatever way is easier for you. In a team environment, you may have to start conforming to more standardized approaches.

 

I prefer to not mix them at all, in a sense. I don't like markup cluttering my code, and I don't like code cluttering my markup. Using a template system like smarty (http://www.smarty.net/) helps you minimize the amount of logic you have in your markup, and keep it away from the PHP code :D

Link to comment
Share on other sites

Also note that the file extension is absolutely meaningless.  I could name all my files something.poop and just process .poop as php, and everything will work exactly the same.  File extensions are a convenience for the user and an instruction for the OS, not something that determines what the file actually IS.

Link to comment
Share on other sites

If your scripts are returning empty documents, with nothing at all in View ---> Source, you're probably developing with display_errors off. You should develop with all errors displayed.

 

You sir, are a genius.  :)  That was exactly it. 

 

Thanks to all three of you!

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.