Here we can see, the $data will contain parameters which will be passed to the template itself. A single method render will compile the template with the data passed to it and return ready-to-use result. That would also allow us to render the page template from many module-based templates:

And lets make an implementation for render method. PHP has such functions as ob_start(), ob_get_clean() for dealing with buffer. The engine that we write will just open new buffer, then execute php code and return the result of php buffer with cleaning it content (this means that the content won’t be printed).