text($markdown); return $html; } /* * Generates cards for a given article. */ function article_card($article_id) { $article_query = 'SELECT * FROM articles WHERE article_id = ' . $article_id . ';'; $article = query_db_one_result($article_query); $article_tags_query = 'SELECT tag FROM article_tags INNER JOIN tags ON article_tags.tag_id = tags.tag_id WHERE article_id = ' . $article_id . ';'; $tags_results = query_db_one_or_more_results($article_tags_query); $tags_html = '
'; while ($row = mysqli_fetch_array($tags_results)) $tags_html .= '#' . $row['tag'] . ''; $tags_html .= '
'; $author_query = 'SELECT username, profile_picture FROM user WHERE user_id = ' . $article['author_id'] . ';'; $author = query_db_one_result($author_query); $card = '

' . $article['title'] . '

Written by: ' . $author['username'] . ' Published: ' . $article['published_at'] . '

' . $article['excerpt'] . '

Read More
' . $tags_html . '
'; return $card; } /* * Displays the article creation wizard and opens a new markdown file. */ function create_article() {}