Unless things have changed since I last looked, PHP files are all templates. Last time I used PHP, with symphony, I actually thought PHP was a pretty reasonable templating system.
Unless things have changed since I last looked, PHP files are all templates. Last time I used PHP, with symphony, I actually thought PHP was a pretty reasonable templating system.
A lot of code written by beginners (myself included, once) will put business logic as close to where it will eventually be rendered as possible, so you end up with code that looks like this
<ul>
<?php
// Thirty lines of database calls and string manipulation
foreach ($results as $result): ?>
<li><?= $result ?></li>
<?php endforeach ?>
</ul>
which makes intuitive sense but quickly leads to an unreadable template. It turns out that, even though you're writing these together, you'll rarely actually want to change them together. So you eventually learn to have template files and nontemplate files.The .php vs .phtml distinction has no relevance to the compiler. They're only really useful to a human in making that template/code distinction explicit.
https://github.com/symfony/Process/blob/master/PhpProcess.ph...
Or in other words, php files are only templates if you use them that way.
Having said which, I'm confused by the lack of a closing ?>. Maybe PHP's parser lets you get away with that though.
It's completely optional.