2

I've been reading a lot of documentation (getSiblings, getDescendants etc) but can't get this to work:

I have a structure, named 'areas'. When showing an entry that is a child of an area in 'areas', I would like to list its siblings (that is in the same place in the hierarchy).

So for example on the url http://localhost/areas/some-area/very-nice-area-number-1, I would like to list very-nice-area-number-2, very-nice-area-number-3, very-nice-area-number-4 and so on (but not the current one (very-nice-area-number-1), of course).

To explain further, using the getNext function is the closest I've come, except that it only gives me one entry, and I want all other entries that holds the same place in the hierarchy under 'some-area'.

carlcs
  • 36,220
  • 5
  • 62
  • 139
osh
  • 91
  • 4
  • 3
    Based on how you describe your problem, it sounds like getSiblings() does exactly what you want. In what way doesn't getSiblings() work for you? – André Elvan Aug 30 '15 at 18:07

1 Answers1

4

As already mentioned in the comments, getSiblings should do exactly what you need.

{% for sibling in entry.getSiblings() %}
    {{ sibling.title }}
{% endfor %}
carlcs
  • 36,220
  • 5
  • 62
  • 139