Jump to content

pages->find not returning value other than default language


antpre
 Share

Recommended Posts

Hy there,

I am starting a multilanguage site (multi language is just for frontend) using alternate fields and Multi-language URLs and page name. 

It works very well as long as I use fields with the $page-> call or a $pages->get and I can switch bettween the two languages nicely.
However when I try to get a bunch of pages with a $pages->find . When I try to display the content of the pages (with a foreach loop) It does only display the fields with their default language values. As a result when I switch to the second language it display nothing.

Sorry but i couldn'd find an answer to this in the doc and threads I read. I guess must be an obvious thing.

Thanks

Link to comment
Share on other sites

Hello @antpre,

that depends on the selector you are using. If your selector is using non-language specific operators, like for example the template name, it should work as expected:

foreach ($pages->find("template=basic-page") as $child) {
	echo $child->title;
}

If your selector is using the page path, then it wouldn't work, because this one is language specific.

Could you please provide an example of an selector you try use, which doesn't work?

Regards, Andreas

Edited by AndZyk
Page path would still show the translated fields
Link to comment
Share on other sites

Also, are the pages in question active? Check the Active? checkbox on page Settings tab next to page names.

Plus are access rights set for those pages, or do they reside under the Admin page?

Link to comment
Share on other sites

Thanks for your answers.

pages was not active ... :-[

The selector was with the template=...

What is confusing me  is that when the english language page name was not active, getting the page with a $pages->get would work properly for both default and english.
Any way problem solved.

Is there a way to toogle the active check box by default (at the template level maybe) ?

Thanks a lot

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...