We develop a site on a couple of machines using git. Everythings works on alle 4 machines.
Now we moved it to the real server and one specific feature doesn’t work on that machine: The blogposts themselfs do not open. I get this on every blogpost:
return function($page) { // fetch the basic set of pages $articles = $page->children()->listed()->flip(); // fetch all tags $tags = $articles->pluck('tags', ',', true); // add the tag filter if($tag = param('tag')) { $articles = $articles->filterBy('tags', $tag, ','); } // apply pagination $articles = $articles->paginate(10); $pagination = $articles->pagination(); return compact('articles', 'tags', 'tag', 'pagination'); };
Again: It works one every other machine we tested it one, just not the production-server… I have no idea whatsoever…
The machine with the issue is a Ubuntu LTS 18.04 Server, the webserver is Apache inside a docker-container. So perhaps some kind of library is not working there? But why does everything else on the page work (including other pages with pagination)?!
Any pointers are very much appreciated!
Here are two examples of broken pages:
https://kgsrastede.de/blogs/schuelerwettbewerb-econo-me
https://kgsrastede.de/blogs/aktion-black-lives-matter
Here is an example of a working subpage
https://kgsrastede.de/allgemeines/schulstruktur/zeitraster
Here is the PHP-Code of the broken blog.
<?php
$items = $page->children()->flip();
$list = $items->paginate(5);
foreach ($list as $item) : ?>
<div class="col-md-12 mt-4">
<div class="card-body">
<h4 class="card-title">
<a href="<?= $item->url() ?>"><?= $item->title() ?></a>
</h4>
<p class="card-category">
<div class="author">
von
<a href="#">
<b><?= $item->author() ?></b>
</a> Datum: <?= $item->date()->toDate("d.m.Y") ?>
</div>
</p>
<div class="card-description">
<?= $item->Text()->blocks()->excerpt(250) ?>
<a href="<?= $item->url() ?>">...weiterlesen</a>
</div>
</div>
</div>
<hr>
<?php endforeach ?>
<?php $pagination = $list->pagination() ?>
<nav>
<ul class="pagination">
<?php if ($pagination->hasPrevPage()) : ?>
<li class="page-item">
<a class="page-link" href="<?= $pagination->prevPageURL() ?>">‹</a>
</li>
<?php else : ?>
<li>
<span>‹</span>
</li>
<?php endif ?>
<!-- Hier nun die mittleren Elemente -->
<?php foreach ($pagination->range(10) as $r) : ?>
<li class="page-item <?= $pagination->page() === $r ? 'active' : '' ?>">
<!-- Hier steckt hinter:
Wenn page() identisch ist mit $r schreibe aria-current (also aktuelle Seite),
ansonsten mache '', also füge nichts ein. Das ist eine extreme Abkürzung.
Damit wird im Endeffekt erreicht, dass mit nur einer Zeile die aktuelle Seite
markiert
-->
<a class="page-link" <?= $pagination->page() === $r ? 'aria-current="page"' : '' ?> href="<?= $pagination->pageURL($r) ?>">
<?= $r ?>
</a>
</li>
<?php endforeach ?>
<?php if ($pagination->hasNextPage()) : ?>
<li class="page-item">
<a class="page-link" href="<?= $pagination->nextPageURL() ?>">›</a>
</li>
<?php else : ?>
<li class="page-item">
<span>›</span>
</li>
<?php endif ?>
</ul>
</nav>