render function with template