Ad block is installed and active. Please support us by disabling it.
HomeSaturday, January 20, 2018, 16:49:55
3

Smarty Paginate Example - Smarty Pagination with PHP

Monday, February 9, 15, 02:08:43, 3 Yaers Ago Via wain, Hits: 4343
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

Link Base 1.1. - Free PHP Link Index Script

Manage your links using a MySQL database. Features easy install, user submission, and an admin panel to add, edit and remove categories and links.

Captcha V1 - Free PHP Script

An anti-spam form protection image written in PHP, Version: 1.1.

Show / Hide Div with CSS

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

MySQL Basic Functions

MySQL Basic Functions - select, delete, update..

PHP Cookies - setcookie

Defines a cookie to be sent along with the rest of the HTTP headers.

PHP Mail

Sends an email.

Link Base Pro :: Free Link Index Script

This script allows you to manage your links using a MySQL database. It features easy install, user submission, and an admin panel to add, edit and remove categories and links.

Creating a Math CAPTCHA with PHP - PHP Tutorial

This tutorial will show you how to create a form with Math Captcha.

PHPBB3 Shoutbox

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

How to set up password for phpMyAdmin in Wamp Server

Password for phpMyAdmin in Wamp
About Author

wain

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