SmartyPaginate
January 31st, 2010
Paginacja – przydatna funkcjonalność jaką oferują SMARTY w dodatku SmartyPaginate.class.php.
require_once(/libs/SmartyPaginate.class.php);
// required connect
SmartyPaginate::connect();
// set items per page
SmartyPaginate::setLimit(10);
SmartyPaginate::setUrl('wymagany_prefix_URL');
// assign your db results to the template
$dane = getAll();
SmartyPaginate::setTotal(count($dane));
$dane = array_slice($dane, SmartyPaginate::getCurrentIndex(),SmartyPaginate::getLimit());
$Smarty->assign('variable', $dane);
// assign {$paginate} var
SmartyPaginate::assign($panel);
// display results
wyświetlenie paginacji
{paginate_middle}

Categories: informacje ogólne