

Very rarely, but probably only in situations where you would too. No, usually I put my HTML in HTML files. They’re usually building blocks… page components, not a full page. I regulate the page flow in PHP, and I don’t like it cluttered up with tons of HTML, inside or outside of echos. I have been known to do stuff like this though:
echo “<div class=‘whatever-container’>”.$Page->pagecomponents[‘contents_of_some_html_file’].“</div>”;
If I go and look at $Page, it will show that $this->pagecomponents is set by reading my template files in so I can grab HTML structures dynamically. If the contents of pagecomponents[‘component’] are set dynamically (they usually are), there won’t be some ugly <php ?> tag in the HTML file, but my $Page class will handle populating it somehow. The architecture I usually use is $Validator is instantiated for a page load, then $Data, so whatever user activity $Validator has detected and cleaned up tells $Data what to do with the data backend (which is usually a combination of Maria and Redis) then $Data gets fed into $Page which figures out what page to build, looks at all my HTML building blocks and figures out how to put them together and populate whatever it needs to. So it will usually be something like (very simplistically)
$Validator = new Validator($_GET, $_POST);
$Data = new Data($Validator);
$Page = new Page($Data);
renderPage($Page->Page);

I know an engineer who had several ponds near his property who built an elaborate contraption to attract and electrocute them. He killed tens of thousands. Hundreds more ignored it and bit him anyway.