3 ms·
Meh. With short tags, and a helper function which can be abstracted away in your stack, you can write the following: <? foreach($row in $results): ?> <di
by whichdan 12y ago
Meh. With short tags, and a helper function which can be abstracted away in your stack, you can write the following:
<? foreach($row in $results): ?>
<div><?= $row['field'] ?></div>
<? endforeach ?>
(Assume the helper function maps htmlspecialchars over an array returned by PDO::FETCH_ASSOC.)
- krapp 12y agoAt that point, though, once you no longer have to echo and escape everything, you have a templating framework on top of PHP. The number and complexity of 'helper functions' differs between this and something like Twig, but it's still using abstractions to manage what PHP doesn't do well on its own. A lot of self-described minimalist templating languages do wind up looking a lot like that. I personally don't want to see raw PHP in anything i'm calling a template but to each their own.