check for every variable,so it will not give error

Apply checks in template.php
Merge pull request #138 from akashjain132/seo_experiment

check for every variable,so it will not give error in future