OK, I thought I made a mistake but I was wrong
I won the bet. You indeed made a mistake in your templates.php
I'd suggest you take the original file and apply the patch again. It seems that when you first applyed the path (you've showed the changes you've made above), you made a mistake, then somebody showed you where is your mistake, and trying to fix that you removed more then supposed to from the file.