But it throw the error Call to a member function exists() on null
I think it’s normal as the page does not really exists (just in draft state) but I don’t know if there is a solution to display this page only if it’s not a draft. I tried with find() but don’t succeed.
How can I “select” draft pages so my client can load/unload content of certain sections of his website?
The page() helper only fetches published pages, so checking if it is a draft is not necessary. However, before you check if the page has children, you should make sure you have a page. So your code should look like this:
<?php if (($page = page('projects')) and $page->hasListedChildren()): ?>
<!-- do something -->
<?php endif ?>