Hi!
I have no insight in the code you use, but the only times I encountered this same error was when I did not include the needed classes.
So: check your header-file to see if it includes the template-class. Otherwise, calling $tpl = new template(...) would result in the given error.
Good luck! Robert-Reinder (rr@nederhoed.com)