<?php require_once('__header.php'); ?>
    <div class="wrap">
        <div class="grid"></div>
        <h1 class="title small"><?php echo _x('Directions of activity', '-'); ?></h1>
        <ul class="directions">


            <?php
            foreach ($page->children() as $item):
                echo '<li><img src="' . $item->image->url . '">'
                    . '<div class="li_content">'
                    . '<figure>' . substr($item->title, 0, 1) . '</figure>'
                    . '<h3>' . $item->title . '</h3>'
                    . '<ul>';
                foreach ($item->children() as $subitem):

                    if ($subitem->numChildren):
                        echo '<li><a href="javascript:void(0)">' . $subitem->title . '</a>';
                        echo '<ul>';
                        foreach ($subitem->children() as $child):
                            echo '<li><a href="' . $child->url() . '">' . $child->title . '</a></li>';
                        endforeach;
                        echo '</ul>';
                    else:
                        echo '<li><a href="' . $subitem->url . '">' . $subitem->title . '</a>';
                    endif;

                    echo '</li>';
                endforeach;
                echo '</ul></div></li>';
            endforeach;
            ?>
        </ul>
    </div>
<?php require_once('__footer.php'); ?>