Update template.class.php

Implementing passing of template variables to extensions