本文整理汇总了PHP中factory::comments_factory方法的典型用法代码示例。如果您正苦于以下问题:PHP factory::comments_factory方法的具体用法?PHP factory::comments_factory怎么用?PHP factory::comments_factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类factory
的用法示例。
在下文中一共展示了factory::comments_factory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
<?php
require_once 'loader.php';
/*
* Saving a new comment to database
*/
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$nickname = $_POST['nickname'];
$text = $_POST['text'];
$post_id = $_GET['id'];
try {
if ($nickname != null && $text != null && $post_id != null) {
$comment = factory::comments_factory();
$comment->savetoDB($post_id, $nickname, $text);
$stmt = $pdo->query('SELECT id,nickname, text FROM comments WHERE post_id=' . $post_id . ' ORDER BY id DESC');
echo '<div class="post-border well well-lg " style="background-color:rgba(16,16,16,0.95);border:15px solid #272727;">' . '<br><div class="margin-auto comment text-left">';
while ($row = $stmt->fetch()) {
echo '<p class="lead text-left" style="color:white;line-height: 1px;">' . $row['nickname'] . ' napisał: </p>
' . "<a href=http://projects.e-kei.pl/inba/reply_comment.php?comment_id=" . $row['id'] . " style=\"text-decoration: none;\"><p class=\"grey\" style=\"font-size:9px;\">" . '(odpowiedz/zobacz wszystkie odpowiedzi)</p></a>' . '<p class="text-left" style="color:white;line-height: 1cm;">' . $row['text'] . '</p>
<hr><div class="clear"></div>';
}
echo '</div></div>';
$stmt->closeCursor();
} else {
throw new InvalidArgumentException("Nie uzupełniłeś wszystkich pól!");
}
} catch (Exception $e) {
echo '<h1 class=" grey text-center">' . $e->getMessage() . '</h1>';
}
echo "<br /><br /><button class=\"btn btn-primary btn-lg\" type=\"button\"><a href=\"http://projects.e-kei.pl/inba\" class=\"white\">Powrót do strony głównej</a></button>";
} else {