Example #1
0
<?php

include_once "../../controller/user/userController.php";
session_start();
$user = $_SESSION["userSession"];
if (is_null($user)) {
    header("Location: http://www.andreseloysv.com/happy/index.php");
    die;
}
$userController = new userController();
$friend = $userController->getFriends($user->id);
$pagination_friends = array_chunk($friend, 2);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <ul class="nav nav-pills">
            <li role="presentation"><a href="#">Friends</a></li>
            <li role="presentation"><a href="#">Followers</a></li>
        </ul>
    </div>
    <div class="panel-body">
        <?php 
for ($index = 0; $index < count($pagination_friends); $index++) {
    ?>
            <div class="row">

                <?php 
    for ($index_friends = 0; $index_friends < count($pagination_friends[$index]); $index_friends++) {
        ?>
                    <div class="col-xs-6"><div class="media">
                            <div class="media-left">
Example #2
0
<?php

include_once "../../controller/user/userController.php";
session_start();
$user = $_SESSION["userSession"];
if (is_null($user)) {
    return "error";
}
$userController = new userController();
$searched_users = $userController->getFriends($user->id);
if (is_null($searched_users)) {
    echo "Not friends.";
} else {
    echo json_encode($searched_users);
}