That is fine if only that one modification uses that template hook. However, it means the code is still evaled and if that means queries, then those queries will get run even though they are not needed. Much better, usually, to put the condition around the code itself.