In the preceding chapters, we have seen many templates and completed a lot of exercises using them. So far there is one template group that we have not touched on. This is the order_emails
template group. We left this template group to the very end because this group contains one of the most complex templates of all and is also the most difficult one to test. This is the confirmation_email.tpl.php
template in the order_emails
template group.
Big templates are difficult to manage as there are tons of HTML tags nested together. The best strategy to manage big templates is to break them into smaller supporting templates. The process of breaking down big chunks of code into smaller ones is so important in modern software development that a name has been coined: refactoring. Refactoring is the key to making our code easier to manage and quality assured. We will demonstrate how to refactor a big template in Exercise 10.2. Before that, we need to add a little trick to...