i have 1 template-file, which is included into main file.
some.template:
...
...
in mai
You could use include
to read and process the file. If you need to post-process the result (I assume that might be the reason for you to read the template into a variable) try output buffering:
ob_start();
include 'some.template';
$out = ob_get_clean();
echo $out;
If you need to modify the template before having PHP process it, you will have to resort to eval. But I would advise you to be very careful with this for obvious security reasons and maybe-not-so-obvious performance reasons. If you just need some variables to be replaced, you should consider using a template engine instead or simple means like preg_replace.
Do not read the file into variable, instead do
include 'some.template';
Since you wish to edit the script before using it, the only way to do this practially is to use:
eval($string);
I'm sure I don't need to tell you not to do this with user input if you value security at all.