Something I can't understand while seeing the verbose phtml templates:

Why the short tag and usual code tokens aren't used in Magento ?

<?= $content ?> instead of <?php echo $content ?>


<? if ($condition) { ?>
<? } ?>

instead of

<?php if ($condition): ?>
<?php endif; ?>

that would clear a bit those template files IMHO.

  • Because there are not recommended, here stackoverflow.com/questions/200640/… you can read some reasons why.
    – kuba_ceg
    Jun 24, 2014 at 20:12
  • Thank you for the link. I just skimmed the answers, and seems like in current PHP version it's more likely to use it. Glad that this was discussed. The only issue is a search and replace in entire Magento.
    – Niloct
    Jun 24, 2014 at 20:26
  • Heh, I always like non-standard code where I can't diff against the original. <grin> I've been where shortcuts take hours and miles longer than the original route. Jun 24, 2014 at 20:35
  • I concur @FiascoLabs this is common in Magento development. That's why you also have to think like merchant, i.e. use features instead of coding everything.
    – Niloct
    Jun 24, 2014 at 21:49

1 Answer 1


PHP short tags <? are only valid if php.ini has short_open_tag enabled. This can cause problems when moving code from one server that supports them to another server that doesn't. In general, it's good practice to always use the full <?php tag.

You can read more about it here

  • Well, a comment above led me to the stackoverflow discussion about this. So, the only reason I see for not doing the search and replace is compatibility with Magento updates.
    – Niloct
    Jun 25, 2014 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.