Back to Multi Domains Support

mvk84359813
mvk84359813

Hello! On pages where I use builderDetails component, I recieve no record, i.e. {{ record.name }} or {{ record.desc }} gives me nothing. But with plugin disabled, everything is ok. How can I fix this?

Linkonoid
Linkonoid

Hello! Apparently this is due to the event model (but this is only an assumption). A few questions:

  • Are we talking about standard CMS pages or Static pages?
  • Do you have links replacement enabled on the page? The fact is that links are replaced on the "cms.page.postprocess" event, it is possible that the builder component uses this event or is somehow related to it
  • Is "Hard mode" enabled to replace the standard CMS router?

Last updated

mvk84359813
mvk84359813

I use standard CMS pages. Hard mode is not enabled.

FastPic.Ru

I made a bind for a specific page with link replacement, and it's working now. So, what should I do next? I want all other pages to work with mdomains. Should I make binds for every page or there is a way to make it easier? If I make two binds, for the problem page and for all other pages (ALL_THEME_PAGES_WITH_REQUEST_PATH, without link replacement), the problem page is working incorrectly again.

mvk84359813
mvk84359813

Hmm. Now I removed all bindings and added just two - for two locales. I also enabled hard mode. All pages seem to work correctly. Why didn't it work earlier? Anyway, thanks for fast answers. Maybe I'll have further questions.

Linkonoid
Linkonoid

I'm glad you were able to fix the problem. Yes, unfortunately, without replacing the original router, similar problems arise (at the moment, so far only such a solution). I have plans for the development of this plugin (but most likely it will already be another plugin based on it, since global changes and addition of functionality are assumed)

mvk84359813
mvk84359813

Hello! I have further questions.

  1. To have a redirect to the desired domain when changing locale with Rainlab.Translate plugin, I have to do this? function onSwitchLocale() { return Redirect::to($this->page->redirectUrl); }

  2. I want to have several locales on one domain, i.e. eu.mysite.com - en, de mysite.com - ru Is this possible? How will this work with redirect (p. 1)?

mvk84359813
mvk84359813

Another question. For now, I made two binds:

eu.xxx.xxx - for english verison

xxx.xxx - for russian version

Everything seems to work ok, but for some reason, when you first visit xxx.xxx, messages (which are in Translate plugin - Translate messages) are in english. They become russian after reloading the page. How can I fix this?

Last updated

mvk84359813
mvk84359813

Hello! Can you help me with the problem in above message?

mvk84359813
mvk84359813

this is my solution (in layout file php section):

use RainLab\Translate\Classes\Translator; use RainLab\Translate\Models\Message; use Cms\Classes\Page as CmsPage;

function onEnd() { $translator = Translator::instance(); $curLocale = $translator->getLocale(true); $cmsPage = CmsPage::inTheme($this->theme); $viewBag = $this->page->viewBag; $viewBagToSettings = ['title', 'layout', 'meta_title', 'meta_description', 'is_hidden'];

Message::setContext($curLocale);
foreach ($viewBagToSettings as $property) {
    $cmsPage->settings[$property] = array_get($viewBag, $property);
}

}

BUT previous question is still actual:

Hello! I have further questions.

To have a redirect to the desired domain when changing locale with Rainlab.Translate plugin, I have to do this? function onSwitchLocale() { return Redirect::to($this->page->redirectUrl); }

I want to have several locales on one domain, i.e. eu.mysite.com - en, de mysite.com - ru Is this possible? How will this work with redirect (p. 1)?

1-9 of 9