Zusatz Frage
bearbeitet von
@@Jnnbo - Nicht angemeldet
> hab noch eine zweite Frage. Um die Seitenzahlen anzuzeigen habe ich diesen Code:
>
> ~~~php
> if ($amount > LIMIT) {
>
> echo "<div class=\"pagination\">";
> for($i=1;$i<=$pages;$i++)
> {
> $active = "";
> if ($_SERVER["QUERY_STRING"] == "page=".$i): $active = "active"; endif;
> echo '<a href="hersteller?page='.$i.'" class="page '.$active.'">'.$i.'</a>';
> }
> echo "</div>";
> }
> ~~~
Ich hab eine dritte Frage: Warum ist der Code so unübersichtlich? [Nicht HTML in PHP](http://forum.selfhtml.org/self/2014/dec/22/ich-bekomme-das-div-nicht-auf-display-none/1627965#m1627965) schachteln, [sondern PHP in HTML](http://forum.selfhtml.org/self/2014/dec/22/ich-bekomme-das-div-nicht-auf-display-none/1627966#m1627966).
<?php>if ($amount > LIMIT): ?>
<div class="pagination">
<?php for($i = 1; $i <= $pages; $i++): ?>
<?php $active = ($_SERVER['QUERY_STRING'] == 'page='.$i) ? 'active' : ''; ?>
<a href="hersteller?page=<?= $i ?>" class="page <?= $active ?>"><?= $i ?></a>
<?php endfor; ?>
</div>
<?php endif; >?
oder gleich
<?php>if ($amount > LIMIT): ?>
<div class="pagination">
<?php for($i = 1; $i <= $pages; $i++): ?>
<a href="hersteller?page=<?= $i ?>" class="page
<?php if ($_SERVER['QUERY_STRING'] == 'page='.$i): ?>
active
<?php endif; ?>
"><?= $i ?></a>
<?php endfor; ?>
</div>
<?php endif; >?
Ich glaub, ich weiß auch die Antwort: Weil du [vollkommen beratungsresistent](http://forum.selfhtml.org/self/2015/jun/26/session-durch-klick-loeschen/1644186#m1644186) bist.
Eine vierte Frage hätte ich aber auch noch: Warum ist die aktuelle Seite im Menü verlinkt?
LLAP 🖖
--
Ist diese Antwort _anstößig_? Dann könnte sie [_nützlich_](http://forum.selfhtml.org/self/2015/jun/21/select-felder/1643860#m1643860) sein.