1

When I view a entry that's belong to a small group of children with a parent assigned. When I view the child, I want to display list all children that the child assigned to?

Is there anyway to achieve this method?

3

I think you're looking for the getSiblings() method. This will return all sibling entries for the current entry. You can also use getParent() to get the parent entry and getChildren() to get the entries child entries.

An example implementation is below:

{% set siblings = entry.getSiblings() %}
{% set parent = entry.getParent() %}
{% set children = entry.getChildren() %}

{% if parent|length %}
  <h2>Parent</h2>
  <p>{{ parent.title }}</p>
{% endif %}

{% if siblings|length %}
  <h2>Siblings</h2>
  {% for entry in siblings %}
    <p>{{ entry.title }}</p>
  {% endfor %}
{% endif %}

{% if children|length %}
  <h2>Children</h2>
  {% for entry in children %}
    <p>{{ entry.title }}</p>
  {% endfor %}
{% endif %}

More info on these methods can be found in the EntryModel documentation.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.