Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Language in Navigation Bar


badjuju

Recommended Posts

Posted

Hi,

I tried putting the Language options in the navigation bar - I used the foldername to determine the language. The only problem is the alignment and text. Can someone please tell me how to fix this.

 

Take a look at: http://207.44.237.249/

 

Thanks.

Posted

Set the class for headerNavigation or whatever the My Account, etc is.

For the location, Look at where you have the bx set to start. Or just cut out the part for the language, look at how the header navigation is located and place the language exactly the same befor it. You might need some filler spacing or such.

Posted

I changed the class to match My Account. I also tried several things, but I'm completely lost.

 

Can you pls look at my code:

 

<table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0" bgColor=#C9DBF0>

 <tr class="headerNavigation" bgColor=#C9DBF0>



<?php

 if (!isset($lng) && !is_object($lng)) {

   include(DIR_WS_CLASSES . 'language.php');

   $lng = new language;

 }



 $languages_string = '';

 reset($lng->catalog_languages);

 while (list($key, $value) = each($lng->catalog_languages)) {





  ?>

  <td align="right" class="headerNavigation"><a href="<?php echo tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type); ?>" class="headerNavigation"><?php echo $value['directory'] ?> </a></td>

 <?php



}



 ?>

 <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, '', 'NONSSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a></td>

 </tr>

</table>

Posted

You can put the code that calls the languages right after the td tag and see what happens - use   to add spacing between the languages and the rest of the header

Posted

When I changed the code, it only shows espanol. I would like it to display the languages in this format: English | Espanol. I was able to get the current language text by using the directory name. Unfortunately, this is in lowercase so I would like to change the first character to uppercase.

 

I am completely lost on this, so any help would be appreciated.

 

Here's the new code:

 

<table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0" bgColor=#C9DBF0>

 <tr class="headerNavigation" bgColor=#003366>







<td align="right" class="headerNavigation">



<?php

if (!isset($lng) && !is_object($lng)) {

  include(DIR_WS_CLASSES . 'language.php');

  $lng = new language;

}



$languages_string = '';

reset($lng->catalog_languages);

while (list($key, $value) = each($lng->catalog_languages)) {





 ?>





<a href="<?php echo tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type); ?>" class="headerNavigation"> <?php echo $value['directory'] ?> </a>

</td>

<?php

}

?>









<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, '', 'NONSSL'); ?>" class="headerNavigation">

<?php echo HEADER_TITLE_CART_CONTENTS; ?></a>

 | 

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

<?php echo HEADER_TITLE_CHECKOUT; ?></a>

</td>



 </tr>

</table>

[/code]

Posted

Ok - I figured out how to change the first character the language to uppercase. Now, I just need to move both languages so they align correctly.

 

Any thoughts?

Posted
Ok - I figured out how to change the first character the language to uppercase. Now, I just need to move both languages so they align correctly.

 

Any thoughts?

 

Never mind - I forgot which way was left. How about one easy one?

 

There's so much space between the languages. How do I change it so it reads English | Espanol

instead of:

English Espanol

Posted
Ok - I figured out how to change the first character the language to uppercase. Now, I just need to move both languages so they align correctly.

 

Any thoughts?

 

Never mind - I forgot which way was left. How about one easy one?

 

There's so much space between the languages. How do I change it so it reads English | Espanol

instead of:

English <TAB> Espanol

Posted

try writting it pulling the file name, as in the header text

Posted

The problem is the while-loop.

If you take a look at the site, http://207.44.237.249/, the languages display correctly except for the space between the language names. Also, the languages are stored in one variable, so whatever I change or substitute, becomes duplicated.

 

If there was a way to store both values in 2 variables, I might be able to resolve it using echo $var1 | $var2

Archived

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

×
×
  • Create New...