Nice write up!
Some tips:
If you simply want to include a PHP file you can put in in “static” and it will be copied over as is.
Instead of creating a “baseof.php.php” you can skip declaring {{ define “main” }}…{{ end }} in “single.php.php”.
Instead of using “readFile” you can put the PHP code directly in “single.php.php” by using “safeHTML” like this “{{ “<?php” | safeHTML }}” whenever your code has “<” or “>”.
This way you can insert template variables in the code, really useful sometimes.