PhileCMS/Phile — pull request #106 by Schlaefer (2014-08-12 19:54:56+00:00)
Title: resets pages keys after sorting to numerical values

I want a simple next/previous page navigation in a blog setup with:

{% for page in pages %}
{% if current_page == page %}
{% if pages[loop.index0 + 1] is defined and pages[loop.index0 + 1].meta.date %}
{% set divider = 1 %}

{{ pages[loop.index0 + 1].title }}

{% endif %}
{% if pages[loop.index0 - 1] is defined and pages[loop.index0 - 1].meta.date %}
{% if divider %}
–
{% endif %}

{{ pages[loop.index0 - 1].title }}

{% endif %}
{% endif %}
{% endfor %}

Alas that's not possible because Phile has no next/previous page property and the `pages` keys aren't integers after the the [sorting in Page.php](https://github.com/PhileCMS/Phile/blob/master/lib/Phile/Repository/Page.php#L97) and so `loop.index + 1` does not work. Reseting the array keys after the sort should fix that and make the previous/next page accessible.