How to render in template file with some conditions?
You should be putting the business logic of deciding what you want to show (or hide) in a preprocess function in your template.php and make use of the show and hide functions to specify what you want rendered.