Something wrong, I tried several possibilities yesterday but I didn’t work.
I’m a bit embarrassed to post my code here, I’ve just learned all php by using kirby. It’s somehow glued together by all the tutorials in the documentation. I guess there are plenty ways to improve my code. Please feel free to comment
Thank you in advance
This is the template:
<section id="buch">
<div id="Container" class="container">
<ul>
<?php $i = 0; foreach($articles as $article): ?>
<li>
<div class="flip mix <?php echo $article->art()->html() ?> <?php echo $article->kategorie()->html() ?> <?php echo $article->thema()->html() ?>">
<div class="buch-datum"><time datetime="<?php echo $article->date('c', 'date') ?>"><?php echo $article->date('ymd', 'date') ?></time></div>
<div class="buch-title"><a name="<?php echo $article->title()->html() ?>"><?php echo $article->title()->html() ?></a></div>
</div>
<div class="panel">
<div class="slidescontainer">
<div class="slidesjs" id="slides-<?= $i ?>">
<?php foreach($article->images() as $image): ?>
<img src="<?php echo $image->url() ?>">
<?php endforeach ?>
</div>
</div>
<div class="buch-wrapper">
<span class="buch-uav"><span class="discription">UNTERTITEL</span><?php echo $article->untertitel()->html() ?></span>
<span class="buch-uav"><span class="discription">AUTOR</span>
<a href="<?php echo $page->url() . '/autor:' . urlencode($article->autor()->html()) ?>"><?php echo $article->autor()->html() ?></a>
<?php echo $article->autor2()->html() ?>
</span>
<span class="buch-uav"><span class="discription">VERLAG</span>
<a href="<?php echo $page->url() . '/verlag:' . urlencode($article->verlag()->html()) ?>"><?php echo $article->verlag()->html() ?></a>
</span>
<span class="buch-sprache"><span class="discription">SPRACHE</span><?php echo $article->sprache() ?></span>
<span class="buch-auflage"><span class="discription">AUFLAGE</span><?php echo $article->auflage()->html() ?></span>
<span class="buch-jahr"><span class="discription">JAHR</span><?php echo $article->jahr()->hmtl() ?></span>
<span class="buch-shop"><span class="discription">SHOP</span><?php echo $article->shop()->html() ?></span>
<span class="buch-land"><span class="discription">LAND</span><?php echo $article->land()->html() ?></span>
<span class="buch-preis"><span class="discription">PREIS</span><?php echo $article->preis()->html() ?></span>
<span class="buch-gebraucht"><span class="discription">GEBRAUCHT</span>
<?php if($article->gebraucht() == '1'): ?><span>✔</span><?php else: ?><span>—</span><?php endif ?>
</span>
<span class="buch-geschenk"><span class="discription">GESCHENK</span>
<?php if($article->geschenk() == '1'): ?><span>✔</span><?php else: ?><span>—</span><?php endif ?>
</span>
<span class="buch-text"><span class="discription">INFO</span><?php echo $article->text()->html() ?></span>
</div>
<div class="buch-wrapper2">
<span class="buch-art"><span class="discription">ART</span>
<a href="<?php echo $page->url() . '/art:' . urlencode($article->art()->html()) ?>"><?php echo $article->art()->html() ?></a>
</span>
<span class="buch-kategorie"><span class="discription">KATEGORIE</span>
<a href="<?php echo $page->url() . '/kategorie:' . urlencode($article->kategorie()->html()) ?>"><?php echo $article->kategorie()->html() ?></a>
</span>
<span class="buch-form"><span class="discription">FORM</span>
<a href="<?php echo $page->url() . '/form:' . urlencode($article->form()->html()) ?>"><?php echo $article->form()->html() ?></a>
</span>
<span class="buch-thema"><span class="discription">THEMA</span>
<a href="<?php echo $page->url() . '/thema:' . urlencode($article->thema()->html()) ?>"><?php echo $article->thema()->html() ?></a>
</span>
<span class="buch-gelesen"><span class="discription">GELESEN</span>
<?php if($article->gelesen() == '1'): ?><span>✔</span><?php else: ?><span>—</span><?php endif ?>
</span>
<span class="buch-nummer"><span class="discription">ID</span>
<time datetime="<?php echo $article->date('c', 'date') ?>"><?php echo $article->date('ymd', 'date') ?></time><?php echo $article->nummer()->html() ?>
</span><span class="buch-typeface"><span class="discription">TYPEFACE</span>
<a href="<?php echo $page->url() . '/typeface:' . urlencode($article->typeface()->html()) ?>"><?php echo $article->typeface()->html() ?></a>
</span>
<span class="buch-gestaltung"><span class="discription">GESTALTUNG</span>
<a href="<?php echo $page->url() . '/gestaltung:' . urlencode($article->gestaltung()->html()) ?>"><?php echo $article->gestaltung()->html() ?></a>
</span>
<span class="buch-sammlung"><span class="discription">SAMMLUNG</span>
<a href="<?php echo $page->url() . '/sammlung:' . urlencode($article->sammlung()->html()) ?>"><?php echo $article->sammlung()->html() ?></a>
</span>
<span class="buch-link"><span class="discription">LINK</span>
<?php if(!$article->links()->empty()): ?>
<ul>
<?php foreach($article->links()->pages() as $item): ?>
<li>
<a href="#<?php echo $item->title()->html() ?>"><?php echo $item->title()->html() ?></a>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
</span>
</div>
</li>
<?php $i++; endforeach ?>
</ul>
</div>
</section>
This is the controller
<?php
return function($site, $pages, $page) {
// fetch the basic set of pages
$articles = $page->children()->visible()->flip();
// add the tag filter
if ($sammlung = param('sammlung')) {
$articles = $articles->filterBy('sammlung', urldecode($sammlung), ',');
};
if($verlag = param('verlag')) {
$articles = $articles->filterBy('verlag', urldecode($verlag), ',');
};
if($typeface = param('typeface')) {
$articles = $articles->filterBy('typeface', urldecode($typeface), ',');
};
if($gestaltung = param('gestaltung')) {
$articles = $articles->filterBy('gestaltung', urldecode($gestaltung), ',');
};
if($autor = param('autor')) {
$articles = $articles->filterBy('autor', urldecode($autor), ',');
};
if($art = param('art')) {
$articles = $articles->filterBy('art', urldecode($art), ',');
};
if($kategorie = param('kategorie')) {
$articles = $articles->filterBy('kategorie', urldecode($kategorie), ',');
};
if($form = param('form')) {
$articles = $articles->filterBy('form', urldecode($form), ',');
};
if($thema = param('thema')) {
$articles = $articles->filterBy('thema', urldecode($thema), ',');
};
// fetch all tags
$tags = $articles->pluck('tags', ',', false);
return compact('articles', 'tags', 'tag', 'sammlung', 'typeface', 'verlag', 'gestalung', 'kategorie', 'art', 'thema', 'form');
};