|
61 | 61 | A blog application |
|
62 | 62 | <?php echo htmlEscape($row['title']) ?>
|
63 | 63 | </title>
|
64 |
| - <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
| 64 | + <?php require 'templates/head.php' ?> |
65 | 65 | </head>
|
66 | 66 | <body>
|
67 | 67 | <?php require 'templates/title.php' ?>
|
68 | 68 |
|
69 |
| - |
70 |
| - <h2> |
71 |
| - <?php echo htmlEscape($row['title']) ?> |
72 |
| - </h2> |
73 |
| - <div> |
74 |
| - <?php echo convertSqlDate($row['created_at']) ?> |
| 69 | + <div class="post"> |
| 70 | + <h2> |
| 71 | + <?php echo htmlEscape($row['title']) ?> |
| 72 | + </h2> |
| 73 | + <div class="date"> |
| 74 | + <?php echo convertSqlDate($row['created_at']) ?> |
| 75 | + </div> |
| 76 | + <?php // This is already escaped, so doesn't need further escaping ?> |
| 77 | + <?php echo convertNewlinesToParagraphs($row['body']) ?> |
75 | 78 | </div>
|
76 |
| - <?php // This is already escaped, so doesn't need further escaping ?> |
77 |
| - <?php echo convertNewlinesToParagraphs($row['body']) ?> |
78 | 79 |
|
79 |
| - <h3><?php echo countCommentsForPost($postId) ?> comments</h3> |
80 |
| - <?php foreach (getCommentsForPost($postId) as $comment): ?> |
81 |
| - <?php // For now, we'll use a horizontal rule-off to split it up a bit ?> |
82 |
| - <hr /> |
83 |
| - <div class="comment"> |
84 |
| - <div class="comment-meta"> |
85 |
| - Comment from |
86 |
| - <?php echo htmlEscape($comment['name']) ?> |
87 |
| - on |
88 |
| - <?php echo convertSqlDate($comment['created_at']) ?> |
| 80 | + <div class="comment-list"> |
| 81 | + <h3><?php echo countCommentsForPost($pdo, $postId) ?> comments</h3> |
| 82 | + |
| 83 | + <?php foreach (getCommentsForPost($pdo, $postId) as $comment): ?> |
| 84 | + <div class="comment"> |
| 85 | + <div class="comment-meta"> |
| 86 | + Comment from |
| 87 | + <?php echo htmlEscape($comment['name']) ?> |
| 88 | + on |
| 89 | + <?php echo convertSqlDate($comment['created_at']) ?> |
| 90 | + </div> |
| 91 | + <div class="comment-body"> |
| 92 | + <?php // This is already escaped ?> |
| 93 | + <?php echo convertNewlinesToParagraphs($comment['text']) ?> |
| 94 | + </div> |
89 | 95 | </div>
|
90 |
| - <div class="comment-body"> |
91 |
| - <?php // This is already escaped ?> |
92 |
| - <?php echo convertNewlinesToParagraphs($comment['text']) ?> |
93 |
| - </div> |
94 |
| - </div> |
95 |
| - <?php endforeach ?> |
| 96 | + <?php endforeach ?> |
| 97 | + </div> |
96 | 98 |
|
97 | 99 | <?php require 'templates/comment-form.php' ?>
|
98 | 100 | </body>
|
|
0 commit comments