function wrapTemplate($file, $slots_handlers) { $template = new lmbMacroTemplate($file, $this->__config); $template->setVars(get_object_vars($this)); //global template vars foreach ($slots_handlers as $name => $handlers) { $template->set('__slot_handlers_' . $name, $handlers); } $template->setChildExecutor($this); //from now we consider the wrapper to be a master variable context echo $template->render(); }