added some more globals to template method (these will be phased out and replaced by a context array)