Ad block is installed and active. Please support us by disabling it.
HomeWednesday, April 25, 2018, 08:52:12
3

Smarty Paginate Example - Smarty Pagination with PHP

Monday, February 9, 15, 02:08:43, 3 Yaers Ago Via wain, Hits: 6906
Smarty Paginate Example, Smarty Pagination with PHP. SmartyPaginate: a class/plugin for data set pagination within the Smarty template environment
Resource Smarty Paginate:

search.php

Code:
function get_db_results()
{
$id = $_GET['id'];
$_query = sprintf("SELECT SQL_CALC_FOUND_ROWS * FROM links WHERE linkname LIKE '%%$id%%' 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(10);
SmartyPaginate::setUrl('search.php');
$smarty->assign('results', get_db_results());
SmartyPaginate::assign($smarty);
$smarty->display('search.php');


search.php(template)

Code:
{section name="results" loop=$results}
{$results[results].linkname}<br />
{/section}

Links {$paginate.first}-{$paginate.last} of {$paginate.total}.
{paginate_prev} {paginate_next}


jeremy Monday, November 19, 2012, 15:50:07

Thank you for useful code example

Sign In

Sponsor

Related

Images In Textarea - CSS

Tutorial Images in Textarea

Show / Hide Div with CSS

CSS Display and Visibility:The visibility property specifies whether or not an element is visible.

PHPBB3 Shoutbox

Vesion: 1.1. Released: 08/08/10, Licence GNU, Price: Free

PHP imagecreate

imagecreate() returns an image identifier representing a blank image of specified size.

PHP filesize

The filesize function returns the size of the specified file.

Password Protect With PHP

Password protect tith PHP - tutorial

PHP Jquery Form

PHP Jquery Form allow your visitors to contact you directly from your website.

PHP $_POST Function

Collect values from a form sent with method post

Adsense crawler errors and robots.txt

How to fix Google AdSense crawler errors in robots.txt

PHP $_SESSION

Session_start creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.
About Author

wain

Date Registered: Sun, Feb 8, 15
Last Time Online: Sun, Mar 18, 18
So far has created 115 entries.
wain
This author has not yet filled in any details.