Code Duplication    Length = 19-20 lines in 2 locations

view/comment/viewAllPosts.php 1 location

@@ 27-45 (lines=19) @@
24
    <h1>Posts</h1>
25
    <p>Create  new post: <a class="createNewPostLink" href="<?= $url ?>">Click here.</a></p>
26
    <div class="viewAllPostsContent">
27
        <?php foreach ($items as $item) : ?>
28
            <?php
29
            $tags = explode(",", $item[1][0]->Category);
30
            $url = $di->url->create("comment/retrieve/" . $item[0]->postid);
31
            $p = "<p> Tags: ";
32
            foreach ($tags as $t) {
33
                $id = $commentController->returnCatId($t);
34
                $p .= '<a class="tag" href=' . $tag . "/" . $t .'>' . $t . '</a> ';
35
            }
36
            $p .= "</p>";
37
            ?>
38
            <div class="post">
39
                <a class="postLink" href="<?= $url ?>">
40
                    <h2><?= $item[0]->posttitle ?></h2>
41
                </a>
42
                <?= $p ?>
43
                <p>Author: <?= $item[0]->postname ?></p>
44
            </div>
45
        <?php endforeach; ?>
46
    </div>
47
</div>
48

view/overview/overview.php 1 location

@@ 48-67 (lines=20) @@
45
    <div class="overviewPosts">
46
        <div class="overviewPostsContent">
47
            <h2>Newest posts</h2>
48
            <?php foreach ($posts as $item) : ?>
49
                <?php
50
                $url = $di->url->create("comment/retrieve/" . $item[0]->postid);
51
52
                $tags = explode(",", $item[1][0]->Category);
53
                $p = "<p class=tags> Tags: ";
54
                foreach ($tags as $t) {
55
                    $id = $commentController->returnCatId($t);
56
                    $p .= '<a class="tag" href=' . $tag . "/" . $t .'>' . $t . '</a> ';
57
                }
58
                $p .= "</p>";
59
                ?>
60
                <div class="post">
61
                    <a class="overviewPostLink" href="<?= $url ?>">
62
                        <h2><?= $item[0]->posttitle ?></h2>
63
                    </a>
64
                    <?= $p ?>
65
                    <p class="Author">Author: <?= $item[0]->postname ?></p>
66
                </div>
67
            <?php endforeach; ?>
68
        </div>
69
    </div>
70
</div>