<?php echo htmlentities($name); ?>
In Django templates: {{ name }}
Things get a bit better if you write your own "h" function: function h($var) { echo htmlentities($var); } <?php echo htmlentities($name); ?>
In Django templates: {{ name }}
Things get a bit better if you write your own "h" function: function h($var) { echo htmlentities($var); }Giving them a template file with something like {$CustomerFirstName}. Which they can then move around without fear of breaking the page makes sense.
And let's be honest there aren't that many websites in the world which have to really worry about the performance implications of using smarty.
There are also nice little shortcuts in Smarty, like wrapping templates in {strip}{/strip} to strip newlines and whitespace which would be tricky in PHP without using output buffering.
<?= htmlentities($name) ?> is a lot better...
We have to have an i18n layer anyway for all output so it ends up being a lot of <?= Msg('message-name') ?> calls. Use some code gen macros and it's tolerable.
Also, XHP seems pretty rad. It gives me ideas. :)
<?= htmlentities($name, ENT_QUOTES, 'UTF-8'); ?><?= $name ?> is my preferred method of printing inline, which shortens it up quite a bit.
<?= h($name) ?>
Which isn't that terrible.The PHP developers don't make this easy though, as "short tags" are officially recommended to be disabled, so to write portable PHP you'd have to do
<?php= h($name) ?>
Every time, which adds visual noise that gets worse the more tags you write.