Question: Using Silverstripe's "ChildrenOf" syntax, I've been successfully able to list all children of a page's parent. It's being used in a "see also" style list on a page.

I'd like to exclude the current page from the list but unsure how to determine which is the same as the current page, as within the control loop I'm in the parent's scope. Any ideas? Here's a pseudocode of what I'm doing:

```
<% control ChildrenOf(page-url) %>
    <!-- Output some stuff, like the page's $Link and $Title -->
<% end_control %>

```

Answer: 
there's a built-in page control for this, so to exclude the current page from your list:

```
<% control ChildrenOf(page-url) %>
    <% if LinkOrCurrent = current %>
        <!-- exclude me -->
    <% else %>
       <!-- Output some stuff, like the page's $Link and $Title -->
    <% end_if %>
<% end_control %>

```

see <http://doc.silverstripe.org/sapphire/en/reference/built-in-page-controls#linkingmode-linkorcurrent-and-linkorsection>

**UPDATE**

as you mentioned in your comment below that you'd like to use the $Pos control, you need to filter the dataobjectset before iterating over it.
add the following to your Page\_Controller class:

```
function FilteredChildrenOf($pageUrl) {
    $children = $this->ChildrenOf($pageUrl);
    if($children) {
        $filteredChildren = new DataObjectSet();
        foreach($children as $child) {
            if(!$child->isCurrent()) $filteredChildren->push($child);
        }
        return $filteredChildren;
    }
}

```

then replace 'ChildrenOf' in your template by 'FilteredChildrenOf':

```
<% control FilteredChildrenOf(page-url) %>
//use $Pos here
<% end_control

```
In Silverstripe 3.1 you can use a method like this - 

```
<% loop $Parent.Children %>
    <% if $LinkingMode != current %>
        <!-- Output some stuff, like the page's $Link and $Title , $Pos etc -->
    <% end_if %>
<% end_loop %>

```

This way you can list all parent's children pages.

See <https://docs.silverstripe.org/en/3.1/developer_guides/templates/common_variables/>