ajout d'une fonction pour faire dans l'autre sens : avoir toute les date (parent et linked) + implémentation de la fonction
This commit is contained in:
parent
7501e2cbb7
commit
9789b645ff
7 changed files with 43 additions and 12 deletions
|
|
@ -1,5 +1,17 @@
|
|||
<?php
|
||||
|
||||
|
||||
function allYears ($article) {
|
||||
$years = new Pages([$article->parent()]);
|
||||
|
||||
foreach (site()->find('textes')->children() as $year) {
|
||||
if ($year->linkedTexts()->toPages()->has($article)) {
|
||||
$years = $years->add($year);
|
||||
}
|
||||
}
|
||||
return $years;
|
||||
}
|
||||
|
||||
function setTitleFontSizeClass($title, $level = 'h1')
|
||||
{
|
||||
$length = strlen($title);
|
||||
|
|
|
|||
|
|
@ -29,9 +29,12 @@
|
|||
|
||||
<span class="light">publié le </span><?php echo $article->published()->toDate('d/m/Y') ?><br>
|
||||
|
||||
<span class="light">dans</span> <a
|
||||
href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a>
|
||||
/ <a
|
||||
<span class="light">dans</span>
|
||||
<?php foreach(allYears($article) as $year):?>
|
||||
<a href="<?= $year->url() ?>"><?= $year->title()?></a>/
|
||||
<?php endforeach ?>
|
||||
|
||||
<a
|
||||
href="/categories/<?= Str::slug($article->category()) ?>"><?= $article->category() ?></a>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -49,9 +49,11 @@
|
|||
|
||||
<span class="light">publié le </span><?php echo $article->published()->toDate('d/m/Y') ?><br>
|
||||
|
||||
<span class="light">dans</span> <a
|
||||
href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a>
|
||||
/ <a
|
||||
<span class="light">dans</span>
|
||||
<?php foreach(allYears($article) as $year): ?>
|
||||
<a href="<?= $year->url() ?>"><?= $year->title() ?></a> /
|
||||
<?php endforeach ?>
|
||||
<a
|
||||
href="/categories/<?= Str::slug($article->category()) ?>"><?= $article->category() ?></a>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,11 @@
|
|||
<span class="light">par</span>
|
||||
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toPage()->title()) ?>"><?= $article->author()->toPage()->title() ?></a><br>
|
||||
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
|
||||
<span class="light">dans</span> <a href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a> / <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||
<span class="light">dans</span>
|
||||
<?php foreach(allYears($article) as $year): ?>
|
||||
<a href="<?= $year->url() ?>"><?= $year->title() ?></a> /
|
||||
<?php endforeach ?>
|
||||
<a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
|
@ -23,7 +23,11 @@
|
|||
<div class="text__infos">
|
||||
<p>
|
||||
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
|
||||
<span class="light">dans</span> <a href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a> / <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||
<span class="light">dans</span>
|
||||
<?php foreach(allYears($article) as $year): ?>
|
||||
<a href="<?= $year->url() ?>"><?= $year->title() ?></a> /
|
||||
<?php endforeach ?>
|
||||
<a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -27,9 +27,11 @@
|
|||
href="/auteurs/<?= Str::slug($article->author()->toPage()->title()) ?>"><?= $article->author()->toPage()->title() ?></a><br>
|
||||
<span class="light">publié le
|
||||
</span><?= $article->published()->toDate('d/m/Y') ?><br>
|
||||
<span class="light">dans</span> <a
|
||||
href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a>
|
||||
/ <a
|
||||
<span class="light">dans</span>
|
||||
<?php foreach(allYears($article) as $year): ?>
|
||||
<a href="<?= $year->url() ?>"><?= $year->title() ?></a> /
|
||||
<?php endforeach ?>
|
||||
<a
|
||||
href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,11 @@
|
|||
<span class="light">par</span>
|
||||
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toPage()->title()) ?>"><?= $article->author()->toPage()->title() ?></a><br>
|
||||
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
|
||||
<span class="light">dans</span> <a href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a> / <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||
<span class="light">dans</span>
|
||||
<?php foreach(allYears($article) as $year):?>
|
||||
<a href="<?= $year->url() ?>"><?= $year->title() ?></a> /
|
||||
<?php endforeach ?>
|
||||
<a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue