I have a page that shows all photos in a category, which is set by the last url segment and then the results re paginated. What i'm trying to do is say that if the last segment is 'all' then show all photos from all categories. So i'm trying the following code, but getting an error and i cannot see why!
Template Code:
{% set categoryName = craft.request.lastSegment %}
{% if categoryName == 'all' %}
{% paginate craft.entries.section('photo').limit(6) as entries %}
{% else %}
{% set category = craft.categories.slug(categoryName) %}
{% paginate craft.entries.section('photo').relatedTo(category).limit(6) as entries %}
{% endif %}
Craft error:
Internal Server Error
Unexpected tag name "else" (expecting closing tag for the "paginate" tag defined near line 12)
Line 12 is {% else %}, btw.
I have the endPaginate code further down the page after the pagination html, like so:
{% if paginate.prevUrl %}
<a href="{{ paginate.prevUrl }}" class="button small expand radius">Previous Page</a>
{% endif %}
{% if paginate.nextUrl %}
<a href="{{ paginate.nextUrl }}" class="button small expand radius">Next Page</a>
{% endif %}
</div>
</div>
{% endpaginate %}