callTemplate function.