Multiple Languages

happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

Yes i do.
admin
Site Admin
Posts: 37242
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

You can use usort function to sort your array in any order.
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

I could use usort from my language template file directly but i need categories with at least a certain number of galleries.
admin
Site Admin
Posts: 37242
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

You can create an array from
<categories

$category[name] = <!--TOTAL_GALLERIES-->;

</categories>


and then filter it.
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

Hello, I have the code you gave me in common.php

Code: Select all

if (!strstr($_SERVER['HTTP_REFERER'], 'domain.com') and !$_GET['force_lng']) {

$str = $_SERVER['REQUEST_URI']; $str2 = substr($str, 3);

   if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'fr')) {
      header("Location: http://www.domain.com/fr".$str."");
      exit;
   } elseif (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'de')) {
      header("Location: http://www.domain.com/de".$str."");
      exit;
.....
   } else {
      header("Location: http://www.domain.com/en".$str."");
      exit;
   }
}
It is working fine. But i see a lot of error in apache error logs:

Code: Select all

PHP Notice:  Undefined index: HTTP_REFERER in /data/www/domain.com/html/scj/cgi/common.php on line 16
PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 47
How can i fix it?

Thank you.
admin
Site Admin
Posts: 37242
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

Add

if (!isset($_SERVER['HTTP_REFERER'])) $_SERVER['HTTP_REFERER'] = '';
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

I also have this error:

Code: Select all

/data/www/pornyep.com/html/kli/cgi/common.php on line 58
[Mon Oct 24 20:44:16.087267 2016] [:error] [pid 4103] [client 157.55.39.88:45268] PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 61
[Mon Oct 24 20:44:16.087271 2016] [:error] [pid 4103] [client 157.55.39.88:45268] PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 64
[Mon Oct 24 20:44:16.087275 2016] [:error] [pid 4103] [client 157.55.39.88:45268] PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 67
[Mon Oct 24 20:44:16.087279 2016] [:error] [pid 4103] [client 157.55.39.88:45268] PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 70
[Mon Oct 24 20:44:16.087284 2016] [:error] [pid 4103] [client 157.55.39.88:45268] PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 73
But have else at the end:

Code: Select all

if (!strstr($_SERVER['HTTP_REFERER'], 'domain.com') and !$_GET['force_lng']) {

$str = $_SERVER['REQUEST_URI']; $str2 = substr($str, 3);

   if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'fr')) {
      header("Location: http://www.domain.com/fr".$str."");
      exit;
   } elseif (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'de')) {
      header("Location: http://www.domain.com/de".$str."");
      exit;
.....
   } else {
      header("Location: http://www.domain.com/en".$str."");
      exit;
   }
}
admin
Site Admin
Posts: 37242
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) $_SERVER['HTTP_ACCEPT_LANGUAGE'] = '';
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

One last error i get:

PHP Notice: Undefined index: force_lng in /data/www/domain.com/html/scj/cgi/common.php on line 20

Code: Select all

if (!isset($_SERVER['HTTP_REFERER'])) $_SERVER['HTTP_REFERER'] = '';

if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) $_SERVER['HTTP_ACCEPT_LANGUAGE'] = '';

if (!strstr($_SERVER['HTTP_REFERER'], 'domain.com') and !$_GET['force_lng']) {

$str = $_SERVER['REQUEST_URI']; $str2 = substr($str, 3);

   if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'fr')) {
      header("Location: http://www.domain.com/fr".$str."");
      exit;
   } elseif (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'de')) {
      header("Location: http://www.domain.com/de".$str."");
      exit;
....
   } else {
      header("Location: http://www.domain.com/en".$str."");
      exit;
   }
}
Line 20 is:

Code: Select all

if (!strstr($_SERVER['HTTP_REFERER'], 'domain.com') and !$_GET['force_lng']) {
admin
Site Admin
Posts: 37242
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

if (!isset($_GET['force_lng'])) $_GET['force_lng'] = '';
Don't forget to run script update
Post Reply