Nav item with link to external page
This commit is contained in:
parent
65263d4ca0
commit
0bb2dede4d
2 changed files with 13 additions and 4 deletions
2
blogs/external.md
Normal file
2
blogs/external.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
%TITLE: Docs
|
||||
%URL: https://mmk2410.org/rangitaki/docs/
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in a new issue