1
desperado
case: multi language based on domain access / Multi language Partner block
  • 2004/8/4 20:28

  • desperado

  • Just popping in

  • Posts: 33

  • Since: 2002/3/20


Hi.

I've a case that maybee someone in this forum has answer for or maybee can help me.

Company XOOPS
Domain registered: www.xoops.de, www.xoops.jp, www.xoops.fr

I wnat to have the same func. as the multilanguage tool. But instead of a user select their language, i want the language to be selected based on domian access.
All the modules / content is the same. by using the multilanguage hack i will get the right content language

Example:
A user access www.xoops.de, i need to display everything in deutch language
If a user access www.xoops.fr, i need to display everything in French language.

Multilingual Partner Block
I wnat to display different partner logos based on language selection / domain access. Is this possible ?

Thanx for all help


2
peterr
Re: case: multi language based on domain access / Multi language Partner block
  • 2004/8/11 11:50

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Hi,

I hope I have understood your needs. There is a site I look after and we have 3 domains on one website, and I use a small PHP script to check which domain it is, and then set various variables and constants, to control what is done. In fact I force the directory path to a specific language. Your case is slightly different, but I'm sure you can modify the script below, and then use the same script on each domain.

You will need to ensure though, that the script gets executed for EVERY other script that is run, this was easy for me, because the product I was using already had a script that was included with every other PHP file, so I simply added an include to point to the small script, which checked the domains.

Anyway, I made up a sample one, hope it helps .......

<?php

// Constants prefixed with string "MLP" indicate Multi Language Pack constants

// If user comes to site with preceeding string "www." , remove it, not required
$httphostname $_SERVER['HTTP_HOST'];
$hostname str_replace("www."""$httphostname);
define('MLP_HOSTNAME'$hostname);

$domains['xoops.de'] = array(
  
'language'=>'de',
  
'domain_no'=>'1',
  
'partner_logo'=>'logo_german.jpg'
);

$domains['xoops.jp'] = array(
  
'language'=>'jp',
  
'domain_no'=>'2',
  
'partner_logo'=>'logo_japanese.jpg'
);

$domains['xoops.fr'] = array(
  
'language'=>'fr',
  
'domain_no'=>'3',
  
'partner_logo'=>'logo_french.jpg'
);

//Default to german language if not found

if (isset($domains[$hostname]['language'])) {
   
$language $domains[$hostname]['language'];
   
$domain_number $domains[$hostname]['domain_no'];
   
$logo $domains[$hostname]['partner_logo'];
}  else {
   
$language 'de';
   
$domain_number '1';
   
$logo 'logo_german.jpg';
}

define('MLP_LANGUAGE'$language);
define('MLP_DOMAIN_NUMBER'$domain_number);
define('MLP_LOGO'$logo);

//Then set any other variables or constants needed for the Multi langauge pack

?>


Peter

Login

Who's Online

220 user(s) are online (104 user(s) are browsing Support Forums)


Members: 0


Guests: 220


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits