Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when multiple siteUrls in config #48

Open
nilsenpaul opened this issue Oct 15, 2015 · 3 comments
Open

Error when multiple siteUrls in config #48

nilsenpaul opened this issue Oct 15, 2015 · 3 comments

Comments

@nilsenpaul
Copy link

If Craft's config-file has an array of siteUrls, for localization purposes, line 259 of the SubscriptionService throws an error on submission:

$result = str_replace("{siteUrl}", craft()->config->get("siteUrl"), $result);
@xtrasmal
Copy link
Contributor

It seems that Formerly has no support for multiple languages yet.

@wiso1234
Copy link
Contributor

yeah sorry we have no need for multi languages at this point so can't justify the time involved with my bosses. If anyone wants to add this that would be awesome

@cole007
Copy link

cole007 commented Nov 10, 2015

This is actually pretty easy to resolve assuming:

  1. you are using the locale set-up recommended by P&T - see http://buildwithcraft.com/docs/multi-environment-configs
  2. you are declaring your locale via a global variable, eg CRAFT_LOCALE. For example, in my site root (index.php) I am declaring a global variable based on a switch conditional against $_SERVER['SERVER_NAME'] - see http://buildwithcraft.com/docs/php-constants

In formerly/services/Formerly_SubmissionsService.php you need to add a conditional based on your locale to line 260:

if (count(craft()->config->get("siteUrl")) > 0) $result = str_replace("{siteUrl}", craft()->config->get("siteUrl")[CRAFT_LOCALE], $result);
else $result = str_replace("{siteUrl}", craft()->config->get("siteUrl"), $result);

Will see if can sort a pull request for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants