====== php-code in {{macro}} templates ====== As you may know {{macro}} compiles initial templates into regular php-class. That's why you can insert any php-blocks in {{macro}} templates, e.g.: You should only understand that any php-block you insert into {{macro}} template will be placed into one of the methods of the generated class. In what exactly method is depending on if any of {{include}}, {{into}}, {{apply}} or {{wrap}} tags were used. That's why if you need some particular variables in your php-block you need to make them available globally (make them attributes of the generated class) or pass them into local scope using extra attributes of the mentioned tags. ===== When it's ok to use php-code in {{macro}} templates ===== Here is the list of situations when we prefer to use raw php-code in {{macro}} templates: * Conditional logic (if/else). MACRO does not have analogs of WACT and tags at the moment. * Complex computations (remember: don't place business logic into templates). * Any non-standard situations when build-in {{macro}} tags are not suit and creating your own {{macro}} tags is time wasting.