Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

how to check what page is it currently


devilgrins

Recommended Posts

Posted

i would like to check if the current page view is eg account history

 

so a if statement of

 

"if current page is account history

$greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_output_string_protected($customer_first_name . ' ' . $customer_last_name), tep_href_link(FILENAME_ACCOUNT_HISTORY));

else

$greeting_string = sprintf(TEXT_GREETING_PERSONAL_TWO, tep_output_string_protected($customer_first_name . ' ' . $customer_last_name), tep_href_link(FILENAME_NEWSLETTER));

 

end the code"

Posted
Try this:
function tep_customer_greeting() {

 global $customer_id, $customer_first_name, $customer_last_name;
// add customer details (1/2) paulm 2004/04/02 (added ", $costumer_last_name")

 if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) {
//      $greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_output_string_protected($customer_first_name), tep_href_link(FILENAME_PRODUCTS_NEW));
// add costumer details (2/2) paulm 2004/04/02, above line replaced by:

     if (basename($PHP_SELF) == FILENAME_ACCOUNT && tep_session_is_registered('customer_id')) {
       $greeting_string = sprintf(TEXT_GREETING_PERSONAL_ONE, tep_output_string_protected($customer_first_name . ' ' . $customer_last_name),  tep_href_link(FILENAME_LOGOFF, '', 'SSL'), tep_href_link(FILENAME_NEWSDESK_REVIEWS));
           } elseif (basename($PHP_SELF) == FILENAME_ACCOUNT_HISTORY_INFO && tep_session_is_registered('customer_id')) {
       $greeting_string = sprintf(TEXT_GREETING_PERSONAL_TWO, tep_output_string_protected($customer_first_name . ' ' . $customer_last_name),  tep_href_link(FILENAME_LOGOFF, '', 'SSL'), tep_href_link(FILENAME_ADDRESS_BOOK));
           } else {    
       $greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_output_string_protected($customer_first_name . ' ' . $customer_last_name), tep_href_link(FILENAME_ACCOUNT_HISTORY),  tep_href_link(FILENAME_LOGOFF, '', 'SSL'));

       }

 } else {
   $greeting_string = sprintf(TEXT_GREETING_GUEST, tep_href_link(FILENAME_LOGIN, '', 'SSL'), tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));

 }


 return $greeting_string;

}

 

 

i have tried your suggestion jack though it never seems to do Peronsal_one or personal_two statements when i go to the corresponding filenames ie account or acount history ino.

 

can anyone help me why

 

thanks for your time!

Posted
Are you saying the code I gave you doesn't recognize the page correctly or your code is not handled correctly once it does?

 

Jack

 

the code doesnt recognise the page.. i have even done a simple.. if i am on this XXX.php page to just echo hello i am on xxx page

Posted

This works for me (tells me the page I'm on):

 

<?php
echo basename($PHP_SELF);
?>

I think you have your "if" statement worded incorrectly.

 

Instead of this:

 

if (basename($PHP_SELF) == FILENAME_ACCOUNT && tep_session_is_registered('customer_id')) {

Try this:

 

if ( (basename($PHP_SELF) == FILENAME_ACCOUNT) && (tep_session_is_registered('customer_id')) ) {

Then again, I could be full of crap...

:lol:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Archived

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

×
×
  • Create New...