Template context manager