Nav item with link to external page

This commit is contained in:
Marcel Kapfer (mmk2410) 2016-12-29 09:40:35 +01:00
parent 65263d4ca0
commit 0bb2dede4d
2 changed files with 13 additions and 4 deletions

2
blogs/external.md Normal file
View File

@ -0,0 +1,2 @@
%TITLE: Docs
%URL: https://mmk2410.org/rangitaki/docs/

View File

@ -46,18 +46,25 @@ class BlogListGenerator
// check if the first line includes a title
if (substr($blog, 0, 6) == "%TITLE") {
// grab the title
$blog = substr($blog, 8, strpos($blog, "\n") - 8);
$itemname = substr($blog, 8, strpos($blog, "\n") - 8);
// if on main blog
if ($blog == "main") {
if ($itemname == "main") {
// create a nav item to the main blog
echo "<a class='nav-item' href='./'>$blogmaintitle</a>";
$atag = "<a class='nav-item' href='./'>$blogmaintitle</a>";
} else {
// create a link to the blog
$link = "./?blog=" . substr($blogname, 0, -3);
// create a nav item to the blog
echo "<a class='nav-item' href='$link'>$blog</a>";
$atag = "<a class='nav-item' href='$link'>$itemname</a>";
}
$blog = substr($blog, strpos($blog, "\n") + 1);
}
// nav item as link to external page
if (substr($blog, 0, 4) == "%URL") {
$itemurl = substr($blog, 6, strpos($blog, "\n") - 6);
$atag = "<a class='nav-item' href='$itemurl'>$itemname</a>";
}
echo $atag;
}
/**