Location: PHPKode > projects > PHP Enter > www/gallery.php
<?php
include('settings.php');
//PHP Enter 3.0.
//Copyright (C) 2011  Predrag Rukavina hide@address.com
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
$tmp = mysql_query("SELECT * FROM categori ORDER BY name ASC"); 
while ($aclrow = mysql_fetch_assoc($tmp))
{
$ccval[] = $aclrow;
}
$smarty->assign('path',$path);
$smarty->assign('title',$title);
$smarty->assign('temp',$temp);
$smarty->assign('categori', @$ccval);
function get_db_results() {
$_query = sprintf("SELECT SQL_CALC_FOUND_ROWS * FROM vgalery order by galid desc LIMIT %d,%d",
            SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit());
$_result = mysql_query($_query);
while ($_row = mysql_fetch_array($_result, MYSQL_ASSOC)) {
$_data[] = $_row;
        }
$_query = "SELECT FOUND_ROWS() as total";
$_result = mysql_query($_query);
$_row = mysql_fetch_array($_result, MYSQL_ASSOC);
SmartyPaginate::setTotal($_row['total']);
mysql_free_result($_result);
return @$_data;
}
require('libs/SmartyPaginate.class.php');
SmartyPaginate::connect();
SmartyPaginate::setLimit(12);
SmartyPaginate::setUrl('gallery.php');
$smarty->caching = 0;
$smarty->assign('results', get_db_results());
SmartyPaginate::assign($smarty);
$smarty->display('gallery.php', $REQUEST_URI);
$smarty->display('footer.php');
?>
Return current item: PHP Enter