From 28a4f0021efffb9907a8277d9f76607fdb67bb1d Mon Sep 17 00:00:00 2001 From: manfromhuh Date: Tue, 26 Jul 2022 10:17:27 -0400 Subject: [PATCH] Update article generation to include a author byline --- common/php/article.php | 17 +++++++++++++++++ common/php/md_read.php | 2 -- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/common/php/article.php b/common/php/article.php index 21c7234..e8622b8 100644 --- a/common/php/article.php +++ b/common/php/article.php @@ -22,6 +22,23 @@ echo "\n\n"; echo("\n"); + if (file_exists('author')){ + $author_name_raw = fopen('author', 'r'); + $author_name = fread($author_name_raw, filesize('author')); + $author_name = str_replace("\n", "", $author_name); + $byline_path = $_SERVER['DOCUMENT_ROOT'].'blog/authors/'.$author_name.'/byline.md'; + if (file_exists($byline_path)){ + echo "
\n" + . read_md($byline_path) + ."
\n"; + } else { + echo "

No byline

"; + echo "

$byline_path

"; + } + fclose($author_name_raw); + }else { + echo "

No author

"; + } if ($tag_data != NULL){ $page_tags = str_getcsv($tag_data); natcasesort($page_tags); diff --git a/common/php/md_read.php b/common/php/md_read.php index 9e3c64d..bf70e5c 100644 --- a/common/php/md_read.php +++ b/common/php/md_read.php @@ -3,9 +3,7 @@ require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php'); function read_md($MD_Path){ #Markdown parseing code. - echo $md_path; $MD_Parser = new ParsedownExtra(); - #$MD_Path = $md_path; $MD_File = fopen($MD_Path, "r") or die("File not found."); $MD_Text = fread($MD_File, filesize($MD_Path)); return $MD_Parser->text($MD_Text);