Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Login/Logout in header.php


Vger

Recommended Posts

Posted

I have been trying to move the Login function from the page to the header file, to work with the logout link. So, when someone first arrives they see the Login link in the header, and once they've logged in they see the Logout link in the header - but I can't get it to work. I've searched 'contributions' and can't seem to find anything there. Does anyone know how to do this, or can anyone point me to a contribution that will help? Many Thanks - Vger

Posted

BACK UP 1st then Change this

<td align="right" class="headerNavigation"> <?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>

 

 

To this

the red is the difference

 

<?php

if (tep_session_is_registered('customer_id'))

{ ?>

<a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a> 

<?

} else {

?>

<a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGIN; ?></a>

}

?>

Posted

Many thanks for that, it works nicely! I knew it was a variation on the 'else' command, but wasn't sure about how to insert it. I was trying to make it work with 'if' something 'else' something different. It would have helped if I had remembered the curly brackets too!

 

Again - many thanks - Vger

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...