Jump to content

page listing with hidden pages not working


bbeer
 Share

Recommended Posts

Hi all

I have a problem listing pages when set on hidden I sue the following code. When I set to pages to unhidden the listing works well. Somehow I don't manage to find the problem.

<?php

$stellen = $pages->get("1035", "sort=sort", "include=hidden")->children;

foreach ($stellen as $stelle){ ?>

<div class="jobList clr">
<div class="col jobContent">
<h2><?php echo $stelle->longtitle;?></h2>
<?php echo $stelle->body;?>
</div>
</div>
<?php 
}?>

Your help is much appreciated.

Link to comment
Share on other sites

I'm not sure where you came to this syntax, but the $pages->get() function doesn't work with multiple parameters. Also a single page can hardly be sorted in any way.

$stellen = $pages->get("id=1035, include=hidden")->children;
$stellen = $pages->get("id=1035, include=hidden")->children("sort=sort");
Link to comment
Share on other sites

I've explained your selector below:

// Get a page with ID 1035, 
// Sort that page with ID 1035 (You can't sort 1 page)
// include page 1035 even when it is hidden (Get will always get the page, regardless if it is hidden)
// Get the children of the page with ID 1035. (Will only get the visible pages)
$stellen = $pages->get("1035", "sort=sort", "include=hidden")->children;
I do think you want something like this:
// Find pages with the 1035 parent
// Sort it
// Include the hidden children
$stellen = $pages->find("parent.id=1035, sort=sort, include=hidden");
  • Like 2
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...