Reputation: 625
I am trying to create a pagination on a template. I need a helping hand. I have a total page count: $numberOfPage. I would like to loop over it to display my pages. However, it is a number and not an array. I don't know how to make it loop between "1" and my total page count to create my navigation.
Here is the piece of code I created. Thanks for any help.
<ol class="">
{foreach $numberOfPage as $page }
{dump($numberOfPage)}
{if !$page@first}
<li>
<a href="#" class="">
<span class="icon-chevron-left"></span>
Préc.
</a>
</li>
<li>
<a href="#" class="">{$page-1}</a>
</li>
{/if}
<li>
<a href="#" class="">{$page}</a>
</li>
{if !$page@last}
<li>
<a href="#" class="">{$page+1}</a>
</li>
<li>
<a href="#" class="">
Suiv.
<span class="icon-chevron-right"></span>
</a>
</li>
{/if}
{/foreach}
</ol>
Upvotes: 0
Views: 219