Has something changed recently regarding the ocalized {siteUrl} setting? I'm setting up a new localized site on MAMP PRO and the old config code I used on several other projects is throwing an error "Array to string conversion".

This works fine:

return array(
'*' => array(
    'omitScriptNameInUrls' => true,
),

'pazzo.dev' => array(
    'devMode' => true,
    'environmentVariables' => array(
        'fileSystemPath' => '/Applications/MAMP/htdocs/pazzo/',
        'siteUrl' => 'http://pazzo.dev:8888/'
    )
),

'*.pazzo.be' => array(
    'devMode' => false,
    'cooldownDuration' => 0,
    'environmentVariables' => array(
        'fileSystemPath' => '/opt/www/pocopazzobvba/web/www.pazzo.be/',
        'siteUrl' => 'http://www.pazzo.be/'
    )
)

);

This (what I have used before) throws the error.

return array(
'*' => array(
    'omitScriptNameInUrls' => true
),
'pazzo.dev:8888' => array(
    'devMode' => true,
    'environmentVariables' => array(
        'siteUrl' => array(
            'en' => 'http://pazzo.dev:8888/en/',
            'fr' => 'http://pazzo.dev:8888/fr/',
            'nl' => 'http://pazzo.dev:8888/'
        ),
        'fileSystemPath' => '/Applications/MAMP/htdocs/pazzo/'
    )
),
'www.pazzo.be' => array(
    'cooldownDuration' => 0,
    'devMode' => false,
    'environmentVariables' => array(
        'siteUrl' => array(
            'en' => 'http://www.pazzo.be/en/',
            'fr' => 'http://www.pazzo.be/fr/',
            'nl' => 'http://www.pazzo.be/'
        ),
        'fileSystemPath' => '/opt/www/pocopazzobvba/web/www.pazzo.be/'
    )
)

);

Am I missing something obvious??

siteUrl works with an array of locales if you're using the actual siteUrl config setting. What you're currently doing is creating a separate 'siteUrl' environment variable, which places in the control panel aren't expecting to be in array format.

More good info on the different ways to set siteUrl here.

So Brad, this:

'pazzo.dev' => array(
    'devMode' => true,
    'environmentVariables' => array(
        'fileSystemPath' => '/Applications/MAMP/htdocs/pazzo/',
    ),
    'siteUrl' => array(
                 'en' => 'http://pazzo.dev:8888/en/',
                 'fr' => 'http://pazzo.dev:8888/fr/',
                 'nl' => 'http://pazzo.dev:8888/'
             )
),

is more like it then? (seems to work fine)

  • This is how to do it, Erwin. Things were more complicate before Craft 2.0 though! – carlcs Feb 24 '15 at 20:02

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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