Putting the conditions into template if tags