This is Magento default feature. In top.link you can find login or logout link.But if you want to put somewhere login/logout button then you need to check whether a user logged in or not by the code given below.
<?php
if ($this->helper('customer')->isLoggedIn() )
{
echo '<a href="<?php echo $this->getUrl('customer/account/login/');?>">Login</a>';
}
else
{
echo '<a href="<?php echo $this->getUrl('customer/account/logout/');?>">Logout</a>';
}
?>
No comments:
Post a Comment