write a logic in template.