Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
Pagination in CodeIgniter: The Complete Guide
Aug 15, 2017 @ 17:07:18

In this new tutorial posted to the TutsPlus.com site author Sajal Soni shares "the complete guide" to handling pagination in a CodeIgniter framework application using built-in tooling included with the framework.

The benefit of using any full-stack web application framework is that you don't have to worry about the common tasks like input handling, form validation and the like, as the framework already provides wrappers for those features. Thus, it allows you to concentrate on the business logic of the application rather than reinventing the wheel over and over again.

Today, we're going to explore an important library in the CodeIgniter framework—the pagination library.

The tutorial walks you through three main things: the basics of the pagination functionality, options you can use to customize it and the configuration options available for the component. Each section comes with code and configuration examples showing how to use the component.

tagged: pagination codeigniter tutorial options configuration example

Link: https://code.tutsplus.com/tutorials/pagination-in-codeigniter-the-complete-guide--cms-29030`

Zend Framework Blog:
Paginating data collections with zend-paginator
Feb 02, 2017 @ 16:26:13

The Zend Framework blog has continued with its series of posts highlighting a component of the framework and some of the benefits and functionality it brings to the table. In their latest post they focus on zend-paginator for easy and automatic pagination of results.

zend-paginator is a flexible component for paginating collections of data and presenting that data to users. Pagination is a standard UI solution to manage the visualization of lists of items, like a list of posts in a blog or a list of products in an online store.

zend-paginator is very popular among Zend Framework developers, and it's often used with zend-view, thanks to the pagination control view helper zend-view provides. It can be used also with other template engines. In this article, I will demonstrate how to use it with Plates.

The tutorial starts with the Composer command to get the component pulled into your project and details what all comes with it. It then shows the creation of a custom adapter type (for "Posts"") and how to use the package to paginate through the results with an example of the output here. Then comes the example using the Plates templating framework via a "PaginatorMiddleware" middleware, a simple template using the pagination object directly and inserting the page navigation via a partial (again making use of the object but getting the values needed to build out the links).

tagged: zendframework pagination zendpaginator plates templating tutorial

Link: https://framework.zend.com/blog/2017-01-31-zend-paginator.html

Matt Stauffer:
Customizing pagination templates in Laravel 5.3
Jul 27, 2016 @ 17:33:36

Matt Stauffer is back with another in his series of posts about the new features coming in the v5.3 release of the popular Laravel framework. In the latest post he looks at pagination improvements allowing you to customize the related templates.

Laravel's pagination library is brilliant, because pagination is a common task that is a surprising amount of work to implement. In the past, if you wanted to customize your pagination templates, it was just as simple to customize your pagination template as it was to work with the rest of the pagination library.

However, for the sake of making the pagination library easier to extract for non-Laravel projects, Laravel 5.0 (or maybe even earlier?) introduced a much more complex—but more portable—system for pagination templates. Thankfully, in Laravel 5.3, we're going to go back to how it always was: simple and easy.

He then gets into the basics of how pagination works in Laravel applications (not the template part, the backend) using the Task::paginate handling. He includes the view to just show the results and the current view handling for the pagination links. Finally he shows how to customize the template in v5.3 by registering a custom view to the partials.paginator and using the links method to inject them into your current template.

tagged: laravel template pagination customize tutorial series v53 framework

Link: https://mattstauffer.co/blog/customizing-pagination-templates-in-laravel-5-3

SitePoint PHP Blog:
Record Retrieval and Pagination in Bolt CMS
Jun 02, 2015 @ 17:29:59

The SitePoint PHP blog has a new tutorial posted showing you how to set up pagination in the results provided by the Bolt CMS that includes handling to grab content from the database and display the results.

Bolt is a lightweight CMS built on Silex with Symfony components that’s fast, easy, and fun to develop with. My recent affinity for Bolt has turned it into my CMS of choice as I make a conscious effort to choose wisely and step away from bloated frameworks. Previously, I gave a very detailed insight into what it’s like developing with Bolt. Today, we’re going to break down a very popular task into steps in order to accomplish it with ease.

He starts with an installation of the Homestead Improved virtual machine and checks out a new copy of Bolt. He sets up a basic Bootstrap-based theme, including header and footer partial views. He then shows how to create "contenttypes" and fetch the current content records. He updates the Twig template to show the results and integrates the simple pagination. He then creates the single page version to view the content and "previous" and "next" links to accompany it.

tagged: bolt cms tutorial pagination content type management silex

Link: http://www.sitepoint.com/record-retrieval-pagination-bolt-cms/

SitePoint PHP Blog:
Pagination with jQuery, AJAX and PHP
May 28, 2015 @ 14:46:57

The SitePoint PHP blog has a new tutorial posted showing you how to set up pagination with jQuery and PHP using a simple Silex-based application.

n this article, we’re going to explain how easy it is to paginate your data set using PHP and AJAX via jQuery. We’re also going to use the Silex framework for simplicity.

The data he's going to paginate through is a list of "people" data with ID, name and age values. He starts by helping you get Silex installed and a new project created. With that in place, he shows how to inject the database connection (PDO) into the application and set up the simple route to output the "people" data back to the waiting Javascript. The route includes a page number value that's used in the LIMIT statement to segment the results into pages. He also includes another route that returns a total count of people records so the pagination knows when to end. With the backend in place, he then moves to the frontend, showing the complete code to get the page records and populate them into the page (via a list).

tagged: pagination tutorial ajax jquery silex people data

Link: http://www.sitepoint.com/pagination-jquery-ajax-php/

SitePoint PHP Blog:
Paginating Real-Time Data with Cursor Based Pagination
Jul 11, 2014 @ 16:52:13

On the SitePoint PHP blog today a new tutorial has been posted introducing you to cursor-based pagination of real-time data, showing the results and allowing for easy click-through functionality.

Pagination is a technique for breaking large record sets into smaller portions called pages. As a developer, you should be familiar with implementing pagination, but implementing pagination for real time data can become tricky even for experienced developers. In this tutorial, we are going to discuss the practical use cases and solutions for real time data pagination and cursor based pagination.

He uses results from the Twitter and Facebook APIs in his examples, grabbing tweets matching the search term "php". He briefly explains some of the issues with real-time pagination and how it compares with standard pagination techniques. He uses the "after" and "before" functionality of each API to only pull the data needed, not the entire list of latest posts. This is added to a list in order and shown when the user view is refreshed. He includes the code for implementing the cursor-based handling and how to echo the results back out to a view.

tagged: cursor pagination twitter facebook api tutorial realtime

Link: http://www.sitepoint.com/paginating-real-time-data-cursor-based-pagination/

SitePoint PHP Blog:
Building a Web App with Symfony 2: Finalizing
Oct 29, 2013 @ 16:49:01

On SitePoint's PHP blog they've posted the last part of their series about building a web application with the Symfony2 framework. In this latest part they cover a few more complex things you can do to add features to your application.

In Part 1 and Part 2 of this series, I have covered the basics of using Symfony 2 to develop a functioning web site. In this part of the tutorial, I will cover some more advanced techniques and finish the project with pagination, image watermarks and NativeQuery.

He uses the default image library to add the watermarks (GD) and adds in a new route to view the cover of the book with the watermark applied. He shows how to add simple pagination into the book listing page (via controller attributes) and the use of the NativeQuery Doctrine provides to do more complex queries.

tagged: symfony2 application tutorial series pagination watermark nativequery

Link: http://www.sitepoint.com/building-web-app-symfony-2-finalizing/

MaltBlue.com:
Use RouteMatch in Zend Framework 2 For Easy Routing
May 02, 2013 @ 16:14:22

In the latest to his site Matthew Setter takes a look at easy routing with RouteMatch in Zend Framework 2 applications. The RouteMatch component gives you better control over your routing and lets you define "match paths" for URL to Controller mappings.

Today using Zend Framework 2 RouteMatch, Router and Request objects, I show you an easy way to dynamically update the current route. It’s almost painlessly simple. [...] Well, like most things in web application development, what starts out simply in the beginner often grows more complex over time. So too is my once simple route.

His "simple" route started getting a bit out of control when he added in some pagination to the page (and query for the path match). He wanted to figure out how to re-render data with the same filters but show the next page of data. He shows how to use the RouteMatch component to achieve just this. He creates a custom module with a "listViewToolbar" helper that lets you read the router, request and handle the parameters sent via the URL. The "invoke" method is called to render the toolbar in the page, complete with the new settings.

tagged: routematch zendframework2 tutorial routing http toolbar pagination

Link: http://www.maltblue.com/tutorial/use-zend-framework-2-routematch-for-dynamic-routing

PHPMaster.com:
Pagination with CodeIgniter
Jan 30, 2012 @ 18:15:22

On PHPMaster.com today there's a new tutorial showing you how to handle simple pagination in a popular PHP framework, CodeIgniter.

Pagination is particularly useful when you are coding an application that interfaces with a database. A large dataset might have hundreds of possible results for one query, and pagination creates a much nicer user experience. In this tutorial, I’ll use CodeIgniter’s pagination library to show you how you can create a paginated list of results from a MySQL database. Along the way, you’ll also see how to fix a problem with the pagination links that the library might produce.

He starts on the backend, creating a model to work with Country information and includes a "fetch_countries" method to grab the limited/paged list. Next up is the controller with an "example1" method that looks to the URL to see what page it should be on. The view is simple enough - just outputting the results back without worrying about how many to show.

tagged: codeigniter framework tutorial pagination mvc country

Link:

Brian Swan's Blog:
Paging Data with the SQL Server Drivers for PHP: Simplified
Jan 27, 2011 @ 18:54:56

Brian Swan has simplified the pagination using the SQL Server drivers for PHP in his latest post. He shows how to use a cursor to move around in the result set from your query.

An oversimplified definition of a database cursor might be this: A cursor is database functionality that allows you to point to a certain location within a result set and allows you to move forward (and sometimes backward, depending upon the cursor type) through the result set one row at a time. [...] In the paging [scenario], I'll use a static cursor since that cursor type would seem to satisfy the requirements of many web-based applications.

He shows how to execute a simple query with a dynamic cursor by specifying it in the connection call. He then uses the sqlsrv_num_rows to find the number of records returned and a sqlsrv_fetch_array call to pull just the page you need. He also includes some handy code to paginate the results, complete with links.

tagged: sqlserver driver pagination numrows tutorial cursor

Link:


Trending Topics: