GithubHelp home page GithubHelp logo

kallaspriit / lightspeed-php-paginator-addon Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 100 KB

Lightspeed-PHP addon for paginating data.

Home Page: http://lightspeed-php.com/add-ons/paginator

PHP 100.00%

lightspeed-php-paginator-addon's Introduction

Lightspeed-PHP paginator helper

Lightspeed-PHP logo

LIGHTSPEED-PHP IS A MINIMALISTIC AND FAST PHP FRAMEWORK aiming to provide basic structure that helps you build your applications faster and more efficiently on solid architecture. It's designed to be small, fast, easy to understand and extend.

Lightspeed-PHP Github project | Homepage

How to install

Download the archive and unpack it to the root directory of your project. Creates a "paginator" directory under "library", "PaginatorHelper.php" under application/helpers and "paginator.php" partial in application/partials. It also comes with "example-style.css" file which contains example css styles that you can use to build your own look-and-feel upon.

Just make sure your application/Autoload.php contains a rule to autoload the Paginator class when needed.

else if ($className == 'Paginator') {
	require_once LIBRARY_PATH.'/paginator/Paginator.php';
}

You need to add translations for it, add the following to the end of your application/translations/main-translations.php file:

// Pager
'pager.label.page' => array(
	LANGUAGE_ENGLISH => 'Page',
),
'pager.label.first' => array(
	LANGUAGE_ENGLISH => 'First',
),
'pager.label.last' => array(
	LANGUAGE_ENGLISH => 'Last',
),
'pager.label.previous' => array(
	LANGUAGE_ENGLISH => 'Previous',
),
'pager.label.next' => array(
	LANGUAGE_ENGLISH => 'Next',
),
'pager.label.count(count)' => array(
	LANGUAGE_ENGLISH => 'Total: %s',
),
'pager.label.showing(items)' => array(
	LANGUAGE_ENGLISH => 'Showing: %s',
),
'pager.label.show-all' => array(
	LANGUAGE_ENGLISH => 'Show all',
),
'pager.label.show-first-page' => array(
	LANGUAGE_ENGLISH => 'Show first page',
),
'pager.label.all' => array(
	LANGUAGE_ENGLISH => 'all',
),

Lastly, the pager needs some CSS to make it look pretty. You can base your own rules on the following:

.pager {
	margin-top: 20px;
}
.pager .pager-stats {
	color: #666;
	font-style: italic;
	font-size: 90%;
	text-align: right;
}
.pager UL {
	margin: 0;
	padding: 0;
	list-style: none;
	height: 26px;
}
.pager LI {
	float: left;
	height: 24px;
	background-color: #f8f8f8;
	line-height: 24px;
}
.pager LI.active {
	border-top: 1px solid #fff;
	background-color: #fff;
}
.pager LI STRONG,
.pager LI A {
	display: block;
	float: left;
}
.pager LI SPAN {
	display: block;
	float: left;
	padding: 0 8px 0 8px;
}
.pager LI A {
	text-decoration: none;
}
.pager LI {
	border-left: 1px solid #eee;
	border-top: 1px solid #eee;
	border-bottom: 1px solid #eee;
}
.pager LI:first-child {
	border-radius: 4px 0 0 4px;
	-moz-border-radius: 4px 0 0 4px;
	-webkit-border-radius: 4px 0 0 4px;
}
.pager LI:last-child {
	border-right: 1px solid #eee;
	border-radius: 0 4px 4px 0;
	-moz-border-radius: 0 4px 4px 0;
	-webkit-border-radius: 0 4px 4px 0;
}

How to use it

An example of how to use the pager in your project is covered on this tutorial page.

Up-to-date version of this tutorial is available on the addons page.

lightspeed-php-paginator-addon's People

Contributors

kallaspriit avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.