html .= ''; } private function navMainHTML(Page $nav_data, array $current): string { $nav_html = ''; static $level = 0; foreach($nav_data->getChildren() as $data) { $class = ''; if(isset($current[$level]) && $data->getEndOfPath() === $current[$level]->getEndOfPath()){ $class = ' current'; } if(count($data->getChildren()) > 0) // titre de catégorie { $nav_html .= '' . "\n"; } else { $target = ''; if(str_starts_with($data->getEndOfPath(), 'http')) // lien vers autre site { $link = $data->getEndOfPath(); // $link = chaine $target = ' target="_blank"'; } elseif($data->getEndOfPath() != '') // lien relatif { $link = new URL(['page' => $data->getPagePath()]); // $link = objet } /*else { echo "else page d'accueil" . '
'; $link = new URL; // page d'accueil }*/ $nav_html .= '
  • ' . $data->getPageName() . '

  • ' . "\n"; } } return $nav_html; } }