1

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.

When I am on page A1.1 I shall be able to display A1.2 and A1.3. Same for A1.2, I shall be able to see A1.1 and A1.3.

If I am on page B1.1, I shall see B1.2 and vice versa.

Note: Every page has an image and a title. I want to get a solution using views.

This thread may be linked to this link if we need the child pages: How to list all child pages of current parent page in drupal 7?

Community
  • 1
  • 1
Moushrat
  • 21
  • 8
  • Do you want to show siblings on all levels so B1 page will show A2 – pete80 Jun 10 '15 at 12:54
  • NO in fact when I am on B1.1 it will show only page B1.2 as they are from the same parent B1. Same applies for parent A1, when I am on page A1.1 I shall see page A1.2 and A1.3 as they are from same parent, A1 – Moushrat Jun 10 '15 at 13:02
  • Yes but are A1 and B1 siblings in a single menu or are they from separate menues? – pete80 Jun 10 '15 at 14:16
  • infact i have a content type for the "functionality list" page and a content type for "functionality page". A1 and B2 are of type functionality list and the A1.1..1.3 and B1.1...1.2 of of functionality type. According to the hierarchy functionality pages are children pages for functionality list page. when I am on functionality page A1.1, the 2 other siblings shall be displayed. Same for B1.Yes both A1 and B1 are siblings whereby each have their own childrens – Moushrat Jun 11 '15 at 01:52
  • Add a contextual filter nid on both pages, in default select content id from url, then down below in advance section check exclude option. – Shabir A. Jun 11 '15 at 18:40

2 Answers2

1

Add a contextual filter nid on both pages, in default select content id from url, then down below in advance section check exclude option.

Shabir A.
  • 306
  • 1
  • 10
0

I managed to do it by creating a view with the following php code in contextual filter

$sibbling = array();
$current = db_query("select menu_name, mlid from {menu_links} where link_path = :node", array(':node' => $_GET['q']));
$current_info = array();
foreach ($current as $value) {
    $current_info[] = $value;
}
if($current_info) {
    $result = db_query("select mlid, plid, link_path, link_title from {menu_links} where link_path != :node and plid = ( select plid FROM {menu_links} WHERE link_path =:node)", array(':node' => $_GET['q']));
    foreach ($result as $row) {
      $sibbling[] = $row;
    }
}
$nids = array();

foreach ($sibbling as $value){
    if( substr( $value->link_path, 0, 5 ) == 'node/' ){
        $nids[] = substr( $value->link_path, 5 );
    }
}

return implode('+',$nids);

And finally in the plus options we got to check "Allow multiple values "

Save and its done ;-)

Moushrat
  • 21
  • 8