ich habe nachfolgende Funktion und möchte gerne die SVG in meiner Navigation einbinden (zum Test ist alles home.svg).
Mit CSS lässt sich die Datei nicht einbinden, auf der Webseite ist die Datei neben der Navigation vorhanden, nur ist diese nicht erkennbar hinsichtlich dem nicht vorhanden Platz. Und ja, ich bin noch Anfänger.

Code: Alles auswählen
function getNavigation(string $activeElement = 'index'):array{
$navigation = [];
$navigationElement = [
'label' => 'Startseite',
'target'=>'index.php',
'active'=>false,
'icon'=>'img/home.svg',
];
$navigation['index']=$navigationElement;
$navigationElement = [
'label' => 'Kontakt',
'target'=>'contact.php',
'active'=>false,
'icon'=>'img/home.svg',
];
$navigation['contact']=$navigationElement;
$navigationElement = [
'label' => 'Über mich',
'target'=>'about.php',
'active'=>false,
'icon'=>'img/home.svg',
];
$navigation['about']=$navigationElement;
$navigationElement = [
'label' => 'Messstellen',
'target'=>'place.php',
'active'=>false,
'icon'=>'img/home.svg',
];
$navigation['place']=$navigationElement;
$navigation[$activeElement]['active'] = true;
return $navigation;
Code: Alles auswählen
<nav>
<ul>
<?php foreach($navigation as $navigationElement):?>
<li <?= ($navigationElement['active'])?'class="active"':'' ?>><a href="<?=$navigationElement['target']?>"><i class="<?= $navigationElement['icon']?>"></i><?=$navigationElement['label']?></a></li>
<?php endforeach;?>
</ul>
</nav>