grigorisk Posted December 8, 2015 Share Posted December 8, 2015 Hi!I have many pages-childrens of my main page with name=rates and i want to get all the childrens of my rates page by their input field value.My input field is checkbox and i want to get the page if checkbox is checked.Any help? Link to comment Share on other sites More sharing options...
Tom. Posted December 8, 2015 Share Posted December 8, 2015 $children = $pages->find('parent=/path/to/parent/, checkbox=1'); foreach($children as $child) { } Is this what you are looking for? Link to comment Share on other sites More sharing options...
DaveP Posted December 8, 2015 Share Posted December 8, 2015 If I understand your question correctly something like this should work. $foo = $pages->get("name=rates")->children("checkbox=1"); I see Tom got there before me, and we are heading along similar lines. Link to comment Share on other sites More sharing options...
grigorisk Posted December 8, 2015 Author Share Posted December 8, 2015 i try both but nothing...my page tree is (i can't upload image so i'll describe it...)pricing (my parent page) heraklion (1st child) heraklion pricelist1(1st child of heraklion) . . . Chania (2nd child) chania pricelist1(1st child of chania) chania pricelist2(2nd child of chania) . . . . . . and i want to get all the children of the pricing page (heraklion, heraklion pricelist, chania, chania pricelist,....) if their checkbox is checked Link to comment Share on other sites More sharing options...
LostKobrakai Posted December 8, 2015 Share Posted December 8, 2015 Something like that? $children_of_price_lists = $pages->get("parent=[has_parent=/pricing/, template=pricelist], my_checkbox=1"); 1 Link to comment Share on other sites More sharing options...
grigorisk Posted December 8, 2015 Author Share Posted December 8, 2015 i found a solution: $my_page=$pages->get("name=pricing"); // get pricing $childrens = $my_page->children; //get childrens foreach ($childrens as $children){ $tables = $children->children("fcheckbox=1"); // get the childrens with checked checkbox foreach ($tables as $locationTable){ . . . } } Link to comment Share on other sites More sharing options...
LostKobrakai Posted December 8, 2015 Share Posted December 8, 2015 You could have this in a single selector like so: $tables = $pages->find("fcheckbox=1, parent=[parent.name=pricing]"); 4 Link to comment Share on other sites More sharing options...
grigorisk Posted December 8, 2015 Author Share Posted December 8, 2015 thank you LostKobrakai 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