5.5.7. Other features and tricks

  1. Closing tags can also have attributes. OPT does not require non-attribute tags in this place, so you can handle them, like in any other tag type.
  2. In order to make some PHP code "dynamic" (in sense of the output caching), call the $this->compiler->dynamic() method and pass the new state as a parameter (true - begins the dynamic code). But notice that this method is also used by the {dynamic} instruction. If you do not want to create conflicts, always check the state in this instruction's processor ($this->compiler->processors['dynamic']->active).
  3. In order to generate a compiler error, call the $this->tpl->error() method. It takes three parameters: the error type (E_USER_ERROR or E_USER_WARNING), the error description and the error code. For user extensions, the codes from 401 are reserved.
  4. The instructions can control, whether they can be executed in master templates, or not. Define the protected class variable $inMaster set to true in order to allow the use in the master template. While processing, you can always check the current state by the $this -> compiler -> master. True means the master template is being processed.