globi Posted July 30, 2013 Share Posted July 30, 2013 Hallo! I'm trying to retrieve all the pages in an array, but I can't find the proper selector.What's the way to get all the pages, no matter of their names, parent, templates, etc.? Best regards,Mick Link to comment Share on other sites More sharing options...
diogo Posted July 30, 2013 Share Posted July 30, 2013 hi! here it is: $pages->find("include=all") Link to comment Share on other sites More sharing options...
apeisa Posted July 30, 2013 Share Posted July 30, 2013 And if Diogo's solution gives you too much pages (admin pages, users, roles etc), then try these: $pages->find("include=hidden"); // or $pages->find(); 1 Link to comment Share on other sites More sharing options...
Soma Posted July 30, 2013 Share Posted July 30, 2013 erm foreach($pages->find() as $p) { echo "<p>{$p->url}</p>"; } returns nothing... but foreach($pages->find("*") as $p) { echo "<p>{$p->url}</p>"; } returns all. While... foreach($pages->find("has_parent!=2") as $p) { echo "<p>{$p->url}</p>"; } would exclude pages under "/processwire/" admin pages. But maybe something also some restriction to template(s) would be good. foreach($pages->find("template=basic-page|article|news") as $p) { echo "<p>{$p->url}</p>"; } 3 Link to comment Share on other sites More sharing options...
globi Posted August 1, 2013 Author Share Posted August 1, 2013 $pages->find("*")That's it. Thanks! Link to comment Share on other sites More sharing options...
ryan Posted August 3, 2013 Share Posted August 3, 2013 $pages->find("*")That's it. Thanks! Maybe I've forgotten something, but I don't know why that works. I don't think we have any code specifically looking for a wildcard like that. Chances are its getting filtered out to nothing, but getting far enough in the Selector engine to let the query proceed... kind of like an id>0 selector. 1 Link to comment Share on other sites More sharing options...
SiNNuT Posted August 3, 2013 Share Posted August 3, 2013 Maybe I've forgotten something, but I don't know why that works. I don't think we have any code specifically looking for a wildcard like that. Chances are its getting filtered out to nothing, but getting far enough in the Selector engine to let the query proceed... kind of like an id>0 selector. Is this the part you're looking for?: wire\core\Sanitizer.php: 427 // disallow some characters in selector values 428 // @todo technically we only need to disallow at begin/end of string 429: $value = str_replace(array('*', '~', '`', '$', '^', '+', '|', '<', '>', '!', '='), ' ', $value); 1 Link to comment Share on other sites More sharing options...
ryan Posted August 4, 2013 Share Posted August 4, 2013 That could be the case that "*" is just being considered a selector value, and is being filtered out. Though without following the path through the code, it's also that the selector engine sees an operator character with no field and no value, and thus excludes it from the equation. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now