What is phtml, and when should I use a .phtml extension rather than .php?

fvgs picture fvgs · Aug 8, 2012 · Viewed 144k times · Source

I'm wondering what the difference between .phtml and .php files is, and when to use one over the other.

Answer

Alex picture Alex · Aug 8, 2012

There is usually no difference, as far as page rendering goes. It's a huge facility developer-side, though, when your web project grows bigger.

I make use of both in this fashion:

  • .PHP Page doesn't contain view-related code
  • .PHTML Page contains little (if any) data logic and the most part of it is presentation-related