Exemple #1
0
            <p>
                <?php 
    if (strlen($art->get_text()) > 500) {
        // Cut the content at the last white space in the first 250 chars
        $text = substr($art->get_text(), 0, 500);
        $last = strrpos($text, ' ');
        $text = substr($text, 0, $last);
        echo BulletBoardCodeParser::convertToHtml($text);
        ?>
                        <span class="more"><a href="/articles/<?php 
        echo $art->get_id();
        ?>
"> ...</a></span>
                <?php 
    } else {
        echo BulletBoardCodeParser::convertToHtml($art->get_text());
    }
    ?>
            </p>
        </div>

        <footer>
            <div>

                <?php 
    if ($art->get_creation_date() != $art->get_change_date()) {
        ?>
                    <span>last modified on <?php 
        echo date('F d, Y', $art->get_change_date());
        ?>
</span>
Exemple #2
0
        $articles->remove_article($id);
        HttpService::return_no_content();
    }
    HttpService::return_bad_request();
}
// GET - Show form
if ($method == "GET") {
    if (!isset($_GET['id'])) {
        HttpService::return_bad_request();
    }
    $id = $_GET['id'];
    $srv = ArticleService::get_instance();
    $article = $srv->get_article($id);
    if (!isset($article)) {
        HttpService::return_not_found();
    }
    $article_id = $article->get_id();
    $title = $article->get_title();
    $keywords = $article->get_keywords();
    $author = $article->get_author();
    $content = BulletBoardCodeParser::convertToHtml($article->get_text());
    $creation_date = date('F d, Y', $article->get_creation_date());
    $commentsSrv = new CommentService();
    $comments = $commentsSrv->get_comments_from_article($article_id);
    $page_title = "Article {$id}";
    $page_content = '../../app/views/articles/details.php';
    include_once '../../app/views/_layout.php';
    exit;
}
// Otherwise
HttpService::return_not_found();