Updated Template.php file with logout option