TCwho Posted February 25, 2005 Share Posted February 25, 2005 Hey everyone. I got rid of my guest message and want to add a login link to header navigation but I want it to only show up when someone is not logged in Here is the code: <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> | <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> | <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> </td> How can I accomplish it: <?php if (tep_session_is_not_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGIN; ?></a> | ??? Drop_Shadow How Did You Hear About Us Email HTML Order Link ---- GMT -5:00 Link to comment Share on other sites More sharing options...
TCwho Posted February 25, 2005 Author Share Posted February 25, 2005 If I can get this to work, I am willing to put it together along with instructions on how to remove the welcome guest ... as I see many people always asking this question... Drop_Shadow How Did You Hear About Us Email HTML Order Link ---- GMT -5:00 Link to comment Share on other sites More sharing options...
boxtel Posted February 25, 2005 Share Posted February 25, 2005 Hey everyone. I got rid of my guest message and want to add a login link to header navigation but I want it to only show up when someone is not logged in Here is the code: ? ?<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> | <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> | <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> </td> How can I accomplish it: <?php if (tep_session_is_not_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGIN; ?></a> | ??? <{POST_SNAPBACK}> if (!tep_session_is_registered('customer_id') { ............ } the exclamation mark means "not" Treasurer MFC Link to comment Share on other sites More sharing options...
TCwho Posted February 25, 2005 Author Share Posted February 25, 2005 I changed to this: <td align="right" class="headerNavigation"><?php if (!tep_session_is_not_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'); ?>" class="headerNavigation"></a> | <?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> | <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> | <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> </td> but got this: Parse error: parse error, unexpected $ in /homepages/***/catalog/includes/header.php on line 104 Drop_Shadow How Did You Hear About Us Email HTML Order Link ---- GMT -5:00 Link to comment Share on other sites More sharing options...
boxtel Posted February 25, 2005 Share Posted February 25, 2005 I changed to this: ? ?<td align="right" class="headerNavigation"><?php if (!tep_session_is_not_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'); ?>" class="headerNavigation"></a> | <?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> | <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> | <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> </td> but got this: <{POST_SNAPBACK}> <td align="right" class="headerNavigation"> <?php if (!tep_session_is_registered('customer_id')) { ?> <a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'); ?>" class="headerNavigation"></a> | <?php } else { ?> <a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a> | <?php } ?> <a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> | <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> </td> Treasurer MFC Link to comment Share on other sites More sharing options...
TCwho Posted February 25, 2005 Author Share Posted February 25, 2005 Thanks Amanda. I got it just before you posted reply! LOL Busy Night! Thank you. Drop_Shadow How Did You Hear About Us Email HTML Order Link ---- GMT -5:00 Link to comment Share on other sites More sharing options...
TCwho Posted February 25, 2005 Author Share Posted February 25, 2005 OH I like how you used the 'else' in the code. It looks 'neater' than what I did: <td align="right" class="headerNavigation"><?php if (!tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGIN, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGIN; ?></a> | <?php } ?><?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> | <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> | <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> </td> Drop_Shadow How Did You Hear About Us Email HTML Order Link ---- GMT -5:00 Link to comment Share on other sites More sharing options...
boxtel Posted February 25, 2005 Share Posted February 25, 2005 Thanks Amanda. I got it just before you posted reply! LOL Busy Night! Thank you. <{POST_SNAPBACK}> without switching between php and back, makes it somewhat faster : <?php echo '<td align="right" class="headerNavigation">'; if (!tep_session_is_registered('customer_id')) { echo '<a href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '" class="headerNavigation"></a> | '; } else { echo '<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '" class="headerNavigation">' . HEADER_TITLE_LOGOFF . '</a> | '; } echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '" class="headerNavigation">' . HEADER_TITLE_MY_ACCOUNT . '</a> | <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '" class="headerNavigation">' . HEADER_TITLE_CART_CONTENTS . '</a> | <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="headerNavigation">' . HEADER_TITLE_CHECKOUT . '</a> </td>'; ?> Treasurer MFC Link to comment Share on other sites More sharing options...
TCwho Posted February 25, 2005 Author Share Posted February 25, 2005 I have switched to your code. No problems. I have a question: I notice after the else statement there is an open { ... but I cant see the closing } .??? Drop_Shadow How Did You Hear About Us Email HTML Order Link ---- GMT -5:00 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.