Update article generation to include a author byline

This commit is contained in:
manfromhuh 2022-07-26 10:17:27 -04:00
parent ba25c81ca6
commit 28a4f0021e
2 changed files with 17 additions and 2 deletions

View File

@ -22,6 +22,23 @@
echo "\n</div><!--End of print-content div-->\n"; echo "\n</div><!--End of print-content div-->\n";
echo("<nav class=\"jmenu\"><div class=\"pmenu\"><ul id=\"back_btn\"><li><a href='..'>Back</a></li></ul></div></nav>\n"); echo("<nav class=\"jmenu\"><div class=\"pmenu\"><ul id=\"back_btn\"><li><a href='..'>Back</a></li></ul></div></nav>\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 "<div class =\"byline\">\n"
. read_md($byline_path)
."</div><!--End byline div-->\n";
} else {
echo "<h2>No byline</h2>";
echo "<p>$byline_path</p>";
}
fclose($author_name_raw);
}else {
echo "<h2>No author</h2>";
}
if ($tag_data != NULL){ if ($tag_data != NULL){
$page_tags = str_getcsv($tag_data); $page_tags = str_getcsv($tag_data);
natcasesort($page_tags); natcasesort($page_tags);

View File

@ -3,9 +3,7 @@
require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php'); require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php');
function read_md($MD_Path){ function read_md($MD_Path){
#Markdown parseing code. #Markdown parseing code.
echo $md_path;
$MD_Parser = new ParsedownExtra(); $MD_Parser = new ParsedownExtra();
#$MD_Path = $md_path;
$MD_File = fopen($MD_Path, "r") or die("File not found."); $MD_File = fopen($MD_Path, "r") or die("File not found.");
$MD_Text = fread($MD_File, filesize($MD_Path)); $MD_Text = fread($MD_File, filesize($MD_Path));
return $MD_Parser->text($MD_Text); return $MD_Parser->text($MD_Text);