Jump to content

Find page where secondary language is not active


asbjorn
 Share

Recommended Posts

I have a web page where all templates have Norwegian (default language) and English (secondary language, ID 1036). Many of my pages have been imported using the API, and so I used a method from How to set language = active via API? to set the secondary language active.

Now I want to output a list of pages where the secondary language is inactive. I have tried the following without luck:

$pages->find("template=basic-page, status1036=0")

But this gives an error: Field does not exist: status1036

Is there another way that makes this possible?

Additional information: basic-page was just an example, I should have been more clear from the beginning. I have multiple templates and a totalt of 170 000 pages to check.

Edited by laban
Added additional information
Link to comment
Share on other sites

Hello @laban,

how about this solution:

<ul>
	<?php
		foreach ($pages->find("template=basic-page") as $child) {
			if (!$child->viewable($languages->get(1036))) {
				echo "<li>{$child->title}</li>";
			}
		}
	?>
</ul>

This way you would iterate over all pages with the template basic-page and check if it is not viewable in your secondary language.

Regards, Andreas

Link to comment
Share on other sites

Thank you for your suggestions. I see now that there are methods that could work with fewer pages, so I have added some additional information in my initial post.  I should have mentioned this in my question:

I have over 170 000 pages to check.

It seems either method suggested is too much to handle.

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

×
×
  • Create New...