rikpotts Posted January 17, 2010 Posted January 17, 2010 Ive added a bit of code to make a basic menu at the top of my index. The thing is... I would like this code to change when my user is logged in. Basically, just so my "Login" button changes to "Logout"! This is what ive got..... <table border="0" width=480 cellspacing="0" cellpadding="0" align=center > <td align="middle" valign="bottom"><div id="tabsJ"> <ul> <li><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '') . '">' . "<span>" . ('Home') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '">' ."<span>" . ('Log in') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'NONSSL') . '">' . "<span>" . ('My Account') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . "<span>" . ('Checkout') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_CONTACT_US, '') . '">' . "<span>" . ('Contact us') . '</a></span>'; ?></li> **************What goes here?******************** <li><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '') . '">' . "<span>" . ('Home') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'NONSSL') . '">' . "<span>" . ('Log Out') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'NONSSL') . '">' . "<span>" . ('My Account') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . "<span>" . ('Checkout') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_CONTACT_US, '') . '">' . "<span>" . ('Contact us') . '</a></span>'; ?></li> </ul> </td> </div> </table> Many Thanks!
spooks Posted January 17, 2010 Posted January 17, 2010 This is basic code to do that <?php $reg = tep_session_is_registered('customer_id') ;?> <a href="<?php echo tep_href_link(($reg ? FILENAME_LOGOFF : FILENAME_LOGIN), '', 'SSL');?>" class="headerNavigation" ><?php echo ($reg ? HEADER_TITLE_LOGOFF : HEADER_TITLE_LOGIN) ; ?> Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
rikpotts Posted January 17, 2010 Author Posted January 17, 2010 Thanks for the reply! Ive been messing with the code posted above for 6hrs now and have very nearly got there! I now have.... <table border="0" width=480 cellspacing="0" cellpadding="0" align=center > <td align="middle" valign="bottom"><div id="tabsJ"> <ul> <li><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '') . '">' . "<span>" . ('Home') . '</a></span>'; ?></li> <li><?php $reg = tep_session_is_registered('customer_id') ;?> <?php echo '<a href="' . tep_href_link(($reg ? FILENAME_LOGOFF : FILENAME_LOGIN), '', 'SSL') . '"' . "<span>" . ('Log In') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'NONSSL') . '">' . "<span>" . ('My Account') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . "<span>" . ('Checkout') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_CONTACT_US, '') . '">' . "<span>" . ('Contact us') . '</a></span>'; ?></li> </ul> </td> </div> </table> My problem now is that it always says "Log In" Does anyone know how I can get it to say "Log Off" when im logged in?
rescuestat Posted January 17, 2010 Posted January 17, 2010 Thanks for the reply! Ive been messing with the code posted above for 6hrs now and have very nearly got there! I now have.... <table border="0" width=480 cellspacing="0" cellpadding="0" align=center > <td align="middle" valign="bottom"><div id="tabsJ"> <ul> <li><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '') . '">' . "<span>" . ('Home') . '</a></span>'; ?></li> <li><?php $reg = tep_session_is_registered('customer_id') ;?> <?php echo '<a href="' . tep_href_link(($reg ? FILENAME_LOGOFF : FILENAME_LOGIN), '', 'SSL') . '"' . "<span>" . ('Log In') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'NONSSL') . '">' . "<span>" . ('My Account') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . "<span>" . ('Checkout') . '</a></span>'; ?></li> <li><?php echo '<a href="' . tep_href_link(FILENAME_CONTACT_US, '') . '">' . "<span>" . ('Contact us') . '</a></span>'; ?></li> </ul> </td> </div> </table> My problem now is that it always says "Log In" Does anyone know how I can get it to say "Log Off" when im logged in? Hello, The reason it says Log On all the time is you have it coded that way, you have 'Log On' as plain text that is always printed. Replace ('Log On') with ($reg ? HEADER_TITLE_LOGOFF : HEADER_TITLE_LOGIN) These two constants should be defined in your includes/languages/english.php if nothing has been changed. That should get it straightened out. Frank
rikpotts Posted January 17, 2010 Author Posted January 17, 2010 Brilliant! Many Thanks! That bit of code makes sense now. I feel relaxed all of a sudden! Nice one!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.