Ich habe mir nun einige Paginationen auf diversen Seiten angesehen und muss gestehen, dass ich erkennen musste, dass mich eigentlich keine so wirklich überzeugt.
Was aber viele, wenn nicht sogar alle gemeinsam haben: nachdem man von der 1.Seitenreihe weg ist und dann im Normalfall der mittlere Seitenlink aktiv ist, kann man fast überall nur noch die Hälfte der gesamt angezeigten Seiten vorspringen - bei Contao sind es zur Zeit 3 Seiten ... und das erkenne ich als äusserst mühsam, wenn man schon mal viel viel weiter blättern möchte.
Bei meinem obigen Beispiel sind's 21 Seiten - und bis man da auf Seite, sagen wir 13 kommt ist's schon mal ein schönes Stück an Klickerei - ausser man kennt als User die Abkürzung über die Adressleiste im Browser
Ich habe für mich mal das Standardtemplate dahingehend angepasst, dass die letzte Seite als Link mit Seitenzahl mit eingefügt wird. Damit kann ich auch 'Seite X von X' ($this->total) weglassen und die Pagination sauber mittig anordnen. Und der User erkennt die aktive Seite und die Zahl der letzten Seite.
HTML-Code:
<!-- indexer::stop -->
<nav class="pagination block" aria-label="<?= $this->pagination ?>">
<p><?= $this->total ?></p>
<ul>
<?php if ($this->hasFirst): ?>
<li class="first"><a href="<?= $this->first['href'] ?>" class="first" title="<?= $this->first['title'] ?>"><?= $this->first['link'] ?></a></li>
<?php endif; ?>
<?php if ($this->hasPrevious): ?>
<li class="previous"><a href="<?= $this->previous['href'] ?>" class="previous" title="<?= $this->previous['title'] ?>"><?= $this->previous['link'] ?></a></li>
<?php endif; ?>
<?php foreach ($this->pages as $page): ?>
<?php if (null === $page['href']): ?>
<?php $activ = $page['page']; ?>
<li><strong class="active"><?= $page['page'] ?></strong></li>
<?php else: ?>
<li><a href="<?= $page['href'] ?>" class="link" title="<?= $page['title'] ?>"><?= $page['page'] ?></a></li>
<?php endif; ?>
<?php endforeach; ?>
<?php $lasttitle = ($this->last['title']); preg_match("/\d+/",$lasttitle,$result); $allpages = $result[0]; $iiv = ($allpages - 3); ?>
<?php if (($this->hasLast) && (($activ) < $iiv)): ?>
<li class="link">...</li>
<li class="link"><a href="<?= $this->last['href'] ?>" class="last" title="<?= $this->last['title'] ?>"><?= $allpages ?></a></li>
<?php endif; ?>
<?php if ($this->hasNext): ?>
<li class="next"><a href="<?= $this->next['href'] ?>" class="next" title="<?= $this->next['title'] ?>"><?= $this->next['link'] ?></a></li>
<?php endif; ?>
<?php if ($this->hasLast): ?>
<li class="last"><a href="<?= $this->last['href'] ?>" class="last" title="<?= $this->last['title'] ?>"><?= $this->last['link'] ?></a></li>
<?php endif; ?>
</ul>
</nav>
<!-- indexer::continue -->
Sieht dann so aus:
Mit Seite 13 so:
Und ab Seite 14 dann so:
live zu sehen auf WieWarsDort ... Startseite runterscrollen
Lesezeichen