2

Using Focus Lab Master Config, I've defined these constants for my dev environment:

define('ENV', 'dev');
define('ENV_FULL', 'Development');
define('ENV_DEBUG', TRUE);
define('ENV_BASE_PATH', '/home/public_html/dev/');
define('ENV_BASE_URL', 'mywebsite.com');

In config.master.php I have this line:

$env_config['tmpl_file_basepath']        = ENV_BASE_PATH . 'templates/';

Now when I check my Global Template Preferences in the CP, I get this:

ENV_BASE_PATHtemplates/

As a test, when I put ENV, ENV_FULL or ENV_DEBUG in the $env_config line in stead, it prints correctly. On my local install there's no issue at all. Did I miss another setting needed to make this work?

3

Do you have the ENV_BASE_PATH constant defined for each environment? It sounds like you only set it up under one.

The goal of this file (config.env.php) is to set constants per environment so you would want it to look something like the following:

if ( ! defined('ENV'))
{
    switch ($_SERVER['HTTP_HOST']) {
        case 'domain.com' :
            define('ENV', 'prod');
            define('ENV_FULL', 'Production');
            define('ENV_DEBUG', FALSE);
            define('ENV_BASE_PATH', '/home/public_html/dev/');
            define('ENV_BASE_URL', 'mywebsite.com');
        break;

        case 'dev.domain.com' :
            define('ENV', 'dev');
            define('ENV_FULL', 'Development');
            define('ENV_DEBUG', TRUE);
            define('ENV_BASE_PATH', '/home/public_html/dev/');
            define('ENV_BASE_URL', 'mywebsite.com');
        break;

        default :
            define('ENV', 'local');
            define('ENV_FULL', 'Local');
            define('ENV_DEBUG', TRUE);
            define('ENV_BASE_PATH', '/home/public_html/dev/');
            define('ENV_BASE_URL', 'mywebsite.com');
        break;
    }
}

You would obviously want to change the paths per environment, but that's the gist.

Question though: Why are you setting constants here rather than just letting the auto-created paths in config.master.php do their thing? What's the goal at hand?

| improve this answer | |
  • Good point. I'm not that familiar with php and setting up my multi env MSM sites took a bit of trial and error. When it eventually all worked I left it alone. The solution you suggested worked, I had an environment that was missing the constants. I did manage to remove them all from config.env.php. Thanks! – Bob H Sep 26 '13 at 11:14

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.