From 0bb2dede4d068f5a79f1db1f95bf18b200148177 Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Thu, 29 Dec 2016 09:40:35 +0100 Subject: [PATCH] Nav item with link to external page --- blogs/external.md | 2 ++ res/php/BlogListGenerator.php | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 blogs/external.md diff --git a/blogs/external.md b/blogs/external.md new file mode 100644 index 0000000..49cf58b --- /dev/null +++ b/blogs/external.md @@ -0,0 +1,2 @@ +%TITLE: Docs +%URL: https://mmk2410.org/rangitaki/docs/ diff --git a/res/php/BlogListGenerator.php b/res/php/BlogListGenerator.php index 8f5caa5..ab0159f 100644 --- a/res/php/BlogListGenerator.php +++ b/res/php/BlogListGenerator.php @@ -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 "$blogmaintitle"; + $atag = "$blogmaintitle"; } else { // create a link to the blog $link = "./?blog=" . substr($blogname, 0, -3); // create a nav item to the blog - echo "$blog"; + $atag = "$itemname"; } + $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 = "$itemname"; + } + echo $atag; } /**