Jump to content

[SOLVED] $pages->get("selector") only returns one page


Hurme
 Share

Recommended Posts

Hi,

I've been building my first Processwire page and everything has gone alright until I needed to call fields from some child-pages.

<?php foreach($pages->get("template=files") as $stuff) : ?>
	<?php print_r($stuff); ?>
<?php endforeach; ?>

I'm using this just to test if things are working. I have 3 pages using "files" template, but this code only returns the first one I made. Changing the order of the pages does not affect this. I'd rather not delete the first page to test if it affects anything, as it has a lot of content already.

I'm sure I'm overlooking something really elementary here. I'm fairly experienced at building websites, but unfortunately not that experienced with PHP.

Link to comment
Share on other sites

Hi,

Alas these pages need to be hidden from find, but if get can only retrieve one page at a time, then that would explain why this isn't going anywhere.

I'm guessing that they need to be put under a hidden parent and made visible themselves then?

Link to comment
Share on other sites

7 minutes ago, Hurme said:

Hi,

Alas these pages need to be hidden from find, but if get can only retrieve one page at a time, then that would explain why this isn't going anywhere.

I'm guessing that they need to be put under a hidden parent and made visible themselves then?

Just do this:

$pages->find("template=files, include=hidden");

 

  • Like 4
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...