Example #1
0
            <br>
            <!-- Wyświtla komunikat o dodaniu wpisu/błędach -->
            <p><?php 
    echo $info;
    ?>
</p>
            <br>

            <table class="table table-striped">
                <tr>
                    <th>Twoje wcześniejsze wpisy:</th>
                    <th>Ilość komentarzy:</th>
                </tr>
                <!-- Wyświetla wszystkie wczesniejsze wpisy zalogowanego użytkownika -->
                <?php 
    $user->loadAllTweets();
    $mysqli->close();
    ?>
            </table>
        <?php 
}
?>
    </div>
    <div class="col-sm-4">

    </div>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"
        integrity="sha256-KXn5puMvxCw+dAYznun+drMdG1IFl3agK0p/pqT9KAo= sha512-2e8qq0ETcfWRI4HJBzQiA3UoyFk6tbNyG+qSaIBZLyW9Xf3sWZHN/lxe9fTh1U45DpPf07yj94KsUHHWe4Yk1A=="
Example #2
0
require_once ROOT_NAME . "/includes/checkProfile.php";
if (isset($_GET["user"])) {
    $db = Database::getInstance();
    $conn = $db->getConnection();
    $currentUser = $id;
    // id from a cookie
    $userId = $_GET["user"];
    $user = new User($conn);
    $user->loadFromDb($userId);
    $nick = $user->getNick();
    echo "<h3>Tweets by:</h3>";
    echo "<h3>" . $nick . "</h3>";
    if (!($currentUser == $userId)) {
        echo "\n        <form method=\"GET\" action=\"createMessage.php\">\n            <input type=\"hidden\" value=\"{$userId}\" name=\"receiver_id\" />\n            <input type=\"hidden\" value=\"{$nick}\" name=\"receiver_nick\" />\n            <button class=\"btn btn-default\" type=\"submint\">Send a message!</button>\n        </form>\n        ";
    }
    $tweetArray = $user->loadAllTweets();
    foreach ($tweetArray as $tweet) {
        echo "<div class='col-md-12 container tweet-block'>";
        $tweetId = $tweet->getId();
        $comments = $tweet->loadAllComments();
        $tweet->show();
        require ROOT_NAME . "/includes/commentForm.php";
        echo "<ul class='comments'>";
        foreach ($comments as $comment) {
            echo "<li>";
            $comment->show();
            $commenter = new User($conn);
            $commenter->loadFromDb($comment->getUserId());
            $commenter->show();
            echo "</li>";
        }