0

I have 2 x sites with base URLs set to @web/en/ and @web/de/

For client entries in a "Clients" section, I have a template at templates/clients/_entry.twig which I want to use for both sites.

What should the Entry URI Format be set to in the Clients section... eg should it be clients/{slug} for both sites? Or should the base url be included in these dynamically somehow?

(New to localisation so please excuse me if I'm doing this totally wrong!)


UPDATE: if I set the URI to clients/{slug} and view en/clients/clientname I get this error...

Warning: chdir(): No such file or directory (errno 2) in /Users/jamesgreig/.composer/vendor/laravel/valet/server.php on line 145

Warning: require(/Users/jamesgreig/Repos/hoskins-craft/web/en/index.php): failed to open stream: No such file or directory in /Users/jamesgreig/.composer/vendor/laravel/valet/server.php on line 147

Fatal error: require(): Failed opening required '/Users/jamesgreig/Repos/hoskins-craft/web/en/index.php' (include_path='.:/usr/local/Cellar/php@7.1/7.1.16/share/pear') in /Users/jamesgreig/.composer/vendor/laravel/valet/server.php on line 147

  • Did you create the en and de folders, and place an index file in both? Because that's what Valet is warning you about. You should have two folders, each with their own index file, and then use define('CRAFT_LOCALE', 'en') and define('CRAFT_LOCALE', 'de') to tell Craft which locale to use for that site (or, if it's Craft 3, I think the constant is CRAFT_SITE). – Paul Apr 9 '18 at 9:50
  • Ah I missed that! So now I get.... Notice: Use of undefined constant CRAFT_BASE_PATH - assumed 'CRAFT_BASE_PATH' in /Users/jamesgreig/Repos/hoskins-craft/web/en/index.php on line 8 Warning: require_once(CRAFT_BASE_PATH/vendor/autoload.php): failed to open stream: No such file or directory in /Users/jamesgreig/Repos/hoskins-craft/web/en/index.php on line 11 Fatal error: require_once(): Failed opening required 'CRAFT_BASE_PATH/vendor/autoload.php' (include_path='.:/usr/local/Cellar/php@7.1/7.1.16/share/pear') in /Users/jamesgreig/Repos/hoskins-craft/web/en/index.php on line 11 – James Greig Apr 9 '18 at 10:48

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.