Example #1
0
require_once 'init/config.php';
if (!empty($_GET['id'])) {
    $article = new Article($_GET['id']);
    $comments = $article->get_comments();
    ?>

<a href="main.php">Home Page</a>

<section>
	<article>
		<h1><?php 
    echo $article->get_title();
    ?>
</h1>
		<p><?php 
    echo $article->get_content();
    ?>
</p>
	</article>
	<hr>
</section>

<section>
	<h3>Comment</h3>

	<?php 
    if (!empty($_POST)) {
        $article->add_comment($_POST['visitor_name'], $_POST['content']);
        echo 'Your comment has been sucessfully added';
        redirectTo('article.php?id=' . $_GET['id'], 2);
    }