getCss(); $output = << {$gt_html->getTitle()} EOL; foreach ($css as $c) { $output .= "\n\n"; } $output .= << EOL; return $output; } function array_key_last_slice($array) { // array_key_last() only available as of php v7.3.0 return key(array_slice($array, -1)); } /** * @param $url the full URL to display * @param $pageLink if not null, means no URL rewritting */ function getMenu(string $scheme, string $domain, string $path, string $prefix=null) { $links = \htmgem\split_path_links($path, $prefix); // Removes the last part, as it won't hold a link $lastLink = array_key_last_slice($links); if ("index.gmi"==$lastLink) { // removes the index page array_pop($links); $lastLink = array_key_last_slice($links); } array_pop($links); $links = array($domain => "$prefix/") + $links; $linkList = array(); foreach ($links as $label=>$link) { $linkList []= "$label\n"; } $linkList [] = $lastLink."\n"; // The last part holds no link $output = "\n"; return $output; } function getFooter(\htmgem\GemtextTranslate_html $gt_html) { return "\n\n"; } function getHtmlWithMenu($gt_html, $scheme, $domain, $path, $prefix=null) { $menu = getMenu($scheme, $domain, $path, $prefix); echo getHeader($gt_html); echo "\n"; echo "\n"; echo "
\n"; echo $gt_html->translatedGemtext; echo "
\n"; echo "\n"; echo getFooter($gt_html); } function get404Gmipage($url) { return <<