Example #1
0
        $start_time = microtime(true);
        $reviews = new RVS();
        if (isset($_GET['action'])) {
            $key = key($_GET['action']);
            $id = $_GET['action'][$key];
            switch ($key) {
                case 'edit':
                    $smarty->assign('review', $reviews->edit($id));
                    break;
                case 'add':
                    //   $smarty->assign('review', $reviews->insert($_GET['action'][$key]));
                    break;
                case 'delete':
                    $reviews->delete(REVIEWS_TABLE, 'id=' . $id);
                    Redirect($reviews->build_url('delete'));
                    break;
                default:
                    Redirect($reviews->build_url('delete'));
                    break;
            }
        } else {
            $smarty->assign('reviews', $reviews->grid());
            // $start_time = microtime(true);
            $nav = new Pagination($reviews->set['pagination']);
            $smarty->assign('pagination', $nav->get_html());
            //   fb(microtime(true) - $start_time);
        }
    }
    // fb(microtime(true) - $start_time);
    $smarty->assign('admin_sub_dpt', 'catalog_reviews.tpl');
}
<?php

include 'config.php';
$max = 6;
$select = "SELECT * FROM test";
$query1 = mysql_query($select) or die(mysql_error());
$total = mysql_num_rows($query1);
$nav = new Pagination($max, $total, $_GET['p']);
$nav->url = 'normal.php?p=';
$query2 = mysql_query($select . " LIMIT " . $nav->start() . "," . $max) or die(mysql_error());
while ($item = mysql_fetch_object($query2)) {
    echo $item->id . ' - <b>' . $item->name . '</b><br />';
}
echo $nav->get_html();
<?php

include 'config.php';
echo '<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>';
$max = 6;
$select = "SELECT * FROM test";
$query1 = mysql_query($select) or die(mysql_error());
$total = mysql_num_rows($query1);
$nav = new Pagination($max, $total, $_GET['p']);
$nav->url = 'theme.php?p=';
$query2 = mysql_query($select . " LIMIT " . $nav->start() . "," . $max) or die(mysql_error());
while ($item = mysql_fetch_object($query2)) {
    echo $item->id . ' - <b>' . $item->name . '</b><br />';
}
echo $nav->get_html('../themes/bootstrap');