21-Aug-2020, 02:48 PM
PHP Code:
<?php
require 'include/init.php';
// PDO check PDO comments and look back earlier codes in project
$conn = require 'include/db.php';
if (isset($_GET['id']))
{
$article = Article::getWithCategories($conn, $_GET['id'], true); // PDO (function calling from Article class)
} else {
$article = null;
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="../mycommentics/frontend/view/default/stylesheet/stylesheet.css" rel="stylesheet" type="text/css">
<!--<link href="style.css" rel="stylesheet" type="text/css">
<link href="../davidcomments/style.css" rel="stylesheet" type="text/css">
<link href="style.css" rel="stylesheet" type="text/css">
<link href="comments.css" rel="stylesheet" type="text/css">-->
<?php require 'include/header.php'; ?>
<?php if ($article): ?>
<article class="">
<h2><?= htmlspecialchars($article[0]['title']); ?></h2>
<time datetime="<?= $article[0]['published_at'] ?>">
<?php
$datetime = new DateTime($article[0]['published_at']);
echo $datetime->format("j F, Y");
?>
</time>
<?php if ($article[0]['category_name']): ?>
<p>Categories:
<?php foreach ($article as $a): ?>
<?= htmlspecialchars($a['category_name']); ?>
<?php endforeach; ?>
</p>
<?php endif; ?>
<?php if ($article[0]['image_file']): ?>
<img src="/uploads/<?= $article[0]['image_file']; ?>" alt="Content Image" height="240" width="360">
<?php endif; ?>
<p><?= htmlspecialchars($article[0]['content']); ?></p>
<?php
$cmtx_logged_in = false;
$cmtx_identifier = $_GET["id"];
$cmtx_reference = $article['title'];
$cmtx_folder = '/mycommentics/';
require($_SERVER['DOCUMENT_ROOT'] . $cmtx_folder . 'frontend/index.php');
?>
</article>
<?php else: ?>
<p>No Article found.</p>
<?php endif; ?>
<?php require 'include/footer.php'; ?>
Here is the code where I'm trying to include the comments in. It also includes the code I am using that is not working. What you see is just one iteration of it...
Thanks for your help.