How to run php code from file_get_contents or file in a function
You could execute the php code and collect the output like this:
ob_start();include "template.phtml";$out1 = ob_get_clean();
Just include()ing the file instead should be fine. I've not dug that deeply into the source code but I'm fairly sure that's how Zend Framework implements templates.
Replacing "echo file_get_contents()" with "include()" as GordonM suggested worked exactly as needed. can't upvote yet since I'm too new but for my needs this is the direct answer to the headlined question.