feat(backoffice): breadcrumbs no layout partilhado (fecha 6.7)
includes/header.php passa a renderizar Painel > $page_title por omissão em qualquer página que não seja o próprio painel — cobre as 34 páginas do backoffice de uma vez, sem editar cada uma. Uma página que queira um trilho mais rico define $breadcrumbs = [['label'=>..., 'url'=>...], ..., ['label'=>'Atual']] antes de incluir o header (o último item, sem 'url', é a página corrente). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
90efdc4bc1
commit
6faad68059
1 file changed
+23
@@ -276,6 +276,29 @@ $app_name = defined('APP_NAME') ? APP_NAME : 'FitMe 3070';
|
||||
<a href="<?= base_url('views/auth/logout.php') ?>" class="btn btn-sm btn-outline-danger"><i class="bi bi-box-arrow-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// Breadcrumbs: a page sets $breadcrumbs = [['label'=>'Equipa','url'=>base_url('views/admin/team/index.php')], ['label'=>'Editar']]
|
||||
// (last item has no 'url' — it's the current page) for a full trail; with
|
||||
// nothing set, this falls back to Painel > $page_title, which is right for
|
||||
// every top-level listing page and wrong for nothing.
|
||||
$breadcrumbs = $breadcrumbs ?? (
|
||||
$page_title !== 'Painel'
|
||||
? [['label' => 'Painel', 'url' => base_url('views/admin/dashboard.php')], ['label' => $page_title]]
|
||||
: []
|
||||
);
|
||||
if ($breadcrumbs): ?>
|
||||
<nav aria-label="breadcrumb" class="px-3 px-md-4 pt-3">
|
||||
<ol class="breadcrumb mb-0 small">
|
||||
<?php foreach ($breadcrumbs as $__i => $__bc): ?>
|
||||
<?php if (!empty($__bc['url']) && $__i < count($breadcrumbs) - 1): ?>
|
||||
<li class="breadcrumb-item"><a href="<?= htmlspecialchars($__bc['url']) ?>"><?= htmlspecialchars($__bc['label']) ?></a></li>
|
||||
<?php else: ?>
|
||||
<li class="breadcrumb-item active" aria-current="page"><?= htmlspecialchars($__bc['label']) ?></li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<div class="p-3 p-md-4">
|
||||
<?php
|
||||
// Show flash messages if any
|
||||
|
||||
Reference in new issue
Block a user