Suppose I have parent pages A1 and B1. A1 has child pages A1.1, A1.2,A1.3 and B1 has child pages B1.1, B1.2. I want to list all the respective child pages on A1 and B1. In every child page I have an image and a title. These 2 information needs to be listed in the form of a teaser on the parent page. I need help in doing this whether by coding or by using views, I don't mind as far as I get the proper results. Thank you
How to list all child pages of current parent page in drupal 7?
1.5k views Asked by Moushrat At
2
There are 2 answers
2
On
I'm using menu_tree_all_data()
to get whole menu structure and then I'm "manually" crawling menu tree.
Also just after reading the tree, I'm calling menu_tree_add_active_path()
which will add active trail indicator. It's part of menu block module so you'll have to install it and don't forget to add dependencies for menu block in your module.
$tree = menu_tree_all_data($menu);
menu_tree_add_active_path($tree);
You can do this is views by creating a view displaying the fields you require or a teaser. Then add a "Content Nid" contextual filter, in the configeration for this filter under "WHEN THE FILTER VALUE IS NOT AVAILABLE" select "Provide default value" and then "PHP Code" then the code I use is as follows
The last thing to do, under "more" at the bottom of the page sellect "Allow multiple values"