/** * utility_funcs.php * Updated with new functions * ch16 * convertToParas() and getFirst() */ require_once '../includes/utility_funcs.php'; // create database connection $conn = dbConnect('read'); $sql = "SELECT article_id, image_id, title, article, DATE_FORMAT(created, '%W, %M %D, %Y') AS created_date, filename, caption FROM php_blog_blog LEFT JOIN php_blog_images USING (image_id) ORDER BY created DESC"; //sorting by created 20xx-xx-xx not the alias
$result = $conn->query($sql); if (!$result) { $error = $conn->error; }
# Robert's Custom Variable (Do Not Use) $tools = true;
# The header section of the layout. include("../includes/header.php"); ?>
$extract = getFirst($row['article']); echo '<p>' . safe($extract[0]); if ($extract[1]) { echo '<a href="details.php?article_id=' . $row['article_id'] . '"> Read More…</a>'; } echo '</p>'; } } } ?> </main> <?php # The side-bar section of the layout use custom path to load from a different folder. include("sidebar.php");
# The footer section of the layout. include("../includes/footer.php"); ?>