Thanks Shimon!
I've solved the problem - I was going about it the wrong way.
Instead of 'dipslaying' the PHP/HTML code I've executed it and passed the resulting HTML content to my class.
Thanks for the Eval information. That looks like the way to go if I was truly executing PHP.