add login/logout link in magento

In this article add login & logout link by coding,
You click in login then redirect to login page after this login link change into logout link dynamically.

Here is code....

<?php if (! Mage::getSingleton('customer/session')->isLoggedIn()): ?>
<li><a href="<?php echo Mage::helper('customer')->getLoginUrl(); ?>" title="<?php echo $this->__('Login') ?>"><?php echo $this->__('Login') ?></a></li>
<?php else: ?>
<li><a href="<?php echo Mage::helper('customer')->getLogoutUrl(); ?>" title="<?php echo $this->__('Logout') ?>"><?php echo $this->__('Logout') ?></a></li>

<?php endif; ?>

Labels: