I'm developing a multi-language site and wish to use the site root level ISO language code folder structure method. But it's not working – I get a blank page when visiting site.com/en/ or site.com/it/. I reckon that my 'fairly intense' consolidated config.php file is not playing ball.

In each of the site root level language code directories I've added the relative language's custom index.php with the usual parameters, eg:

$system_path = '../../sys';

$assign_to_config['global_vars'] = array(
    "country_code" => "en", 
    "language" => "English"
$assign_to_config['site_url'] = getenv('HTTP_HOST') . "/en/";

Yes, my system folder is above the webroot.

My 'intense' config file instead relies on an initial set of $base_path and $base_url environment agnostic statements that then get reused throughout the config file:

$protocol               = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$base_url               = $protocol . $_SERVER['HTTP_HOST'];
$base_path              = $_SERVER['DOCUMENT_ROOT'];
$system_folder          = "sys";
$uploads_folder         = "images/uploads";
$uploads_path           = $base_path . "/" . $uploads_folder;
$uploads_url            = $base_url . "/" . $uploads_folder;
$images_folder          = "images";
$images_path            = $base_path . "/" . $images_folder;
$images_url             = $base_url . "/" . $images_folder;
$config['base_url']     = $base_url . "/";
$config['base_path']    = $base_path . "/";
$config['index_page']   = "";
$config['site_index']   = "";
$config['site_url']     = $config['base_url'];
$config['site_path']    = $config['base_path'];
$config['server_path']  = $_SERVER['DOCUMENT_ROOT'];
... and so forth

Wherever a base_path or base_url is required by a config setting I simply call on $config['base_path'] and $config['base_url'] in the setting's declaration.

How should I go about assigning the ['global_vars'] set in /en/index.php to my config file? Clearly, I think, the initial two $base_url and $base_path need to wake up that there's an extra /en/ or /it/ segment to deal with in the whole equation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.