Esempio n. 1
0
function getRecentlyGoods()
{
    if (isset($_COOKIE['recently'])) {
        $recently = unserialize($_COOKIE['recently']);
        if (is_array($recently)) {
            foreach ($recently as $id) {
                $result[] = getGoodOnId($id);
            }
        }
        return $result;
    }
}
Esempio n. 2
0
<?php

if (!empty($goods) and is_array($goods)) {
    foreach ($arr as $good) {
        $viewsGoods[$good['id']] = $good['views'];
    }
    arsort($viewsGoods);
    $viewsGoods = array_slice($viewsGoods, 0, 3, true);
    ?>
<div class="list-group">
<?php 
    foreach ($viewsGoods as $id => $views) {
        $good = getGoodOnId($id);
        if (!empty($good['image'])) {
            $img = array_shift(unserialize($good['image']));
        }
        ?>
<a href="<?php 
        echo $_SERVER['PHP_SELF'] . '?id=' . $good['id'];
        ?>
" id="ipopup" class="list-group-item">
    <p class="list-group-item-heading">
        <?php 
        echo $good['title'];
        ?>
    </p>
    <p class="list-group-item-text"><img src="/<?php 
        echo $img;
        ?>
" width="100%" alt=""></a></p>
</a>