lpa Posted March 19, 2016 Share Posted March 19, 2016 I have a multi-language site having artist pages with three languages. The content is shown correctly on the artist page. When I try to refer to those pages through a Page field called artists on an artist list page, I don't get the right language content. echo $page->title; $children = $page->artists; foreach($children as $c) { echo $c->body; echo {$user->language->title}; } The title is shown in the correct language. $user->language->title is show in the correct language. But $c->body is always in the default language. I don't understand what I am missing. PW version 2.6.5. Link to comment Share on other sites More sharing options...
lpa Posted March 20, 2016 Author Share Posted March 20, 2016 I still don't understand why is this not working. Is there something fundamentally wrong in my example? Link to comment Share on other sites More sharing options...
apeisa Posted March 21, 2016 Share Posted March 21, 2016 Few things that might be affecting (all from here https://processwire.com/api/multi-language-support/multi-language-fields/#how-language-fields-work). foreach($page->artists as $c) { $c->of(true); // Output formatting needs to be on for multilang $user->language = $languages->get("french"); // replace "french" with some langname you have echo $c->body; echo {$user->language->title}; } Try above and if it works then you might find the problem. 2 Link to comment Share on other sites More sharing options...
lpa Posted March 21, 2016 Author Share Posted March 21, 2016 Thanks Antti! Something strange happened, because now it is working even without those additions you suggested. I must have messed with the settings. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now