4. Using other features in our environment

Our template processing environment utilizes the opt:include instruction, so we can ask a question, where to use the rest of the modularization features. As we mentioned before, the template inheritance can be used to derive a group of similar layouts from a single core template. It is also very useful for forms, because a single form is often used in many different places, sometimes with additional fields. All the commonly used template parts should be stored as snippets in snippets.tpl and in case of OPT 2.1 - in procedures, too. We do not recommend using components and template functions to represent some commonly used parts, because they are designed for different purposes. Many OPT beginners make this mistake, inspired by other template engines where it was often the only way.

In many applications, there appear some common pages, such as the confirmation whether we want to execute a certain operation. They may be used by many actions. The best choice is to declare them as controller methods that modify the $this->view property, setting it to such a common template and configuring it.