шаг 3 завершен
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var array<int, array{title: string, url?: string}> $breadcrumbs */
|
||||
?>
|
||||
<?php if ($breadcrumbs !== []): ?>
|
||||
<nav class="breadcrumbs" aria-label="Хлебные крошки">
|
||||
<?php foreach ($breadcrumbs as $index => $item): ?>
|
||||
<?php if ($index > 0): ?>
|
||||
<span class="breadcrumbs-separator">/</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($item['url']) && $index < count($breadcrumbs) - 1): ?>
|
||||
<a href="<?= e($item['url']) ?>"><?= e($item['title']) ?></a>
|
||||
<?php else: ?>
|
||||
<span><?= e($item['title']) ?></span>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var array<int, array<string, mixed>> $items */
|
||||
/** @var int $depth */
|
||||
?>
|
||||
<ul class="category-list depth-<?= e((string) $depth) ?>">
|
||||
<?php foreach ($items as $category): ?>
|
||||
<li>
|
||||
<a href="/catalog/<?= e($category['slug']) ?>"><?= e($category['name']) ?></a>
|
||||
<?php if (!empty($category['children'])): ?>
|
||||
<?php
|
||||
$previousItems = $items;
|
||||
$items = $category['children'];
|
||||
$depth++;
|
||||
require __DIR__ . '/category-tree.php';
|
||||
$depth--;
|
||||
$items = $previousItems;
|
||||
?>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
Reference in New Issue
Block a user