Comments (11)
@gorkijatt this is a great solution but the main master repository needs to be updated with this somehow - not sure if the author is still actively updating this library.
my solution was using jquery, sort of a temporary bandaid until we can pull the next updated version.
<script>
$(document).ready(function() {
$('.pagination li').addClass('page-item');
$('.pagination li a').addClass('page-link');
});
</script>
from php-paginator.
For Bootstrap 4 You Need to update css classes
go to your vendor path mine look like this vendor/jasongrimes/paginator/src/JasonGrimes/Paginator.php
edit Paginator.php file look for toHtml() function comment the old function or replace the function with code below :)
public function toHtml()
{
if ($this->numPages <= 1) {
return '';
}
$html = '<ul class="pagination">';
if ($this->getPrevUrl()) {
$html .= '<li class="page-item"><a class="page-link" href="' . htmlspecialchars($this->getPrevUrl()) . '">« '. $this->previousText .'</a></li>';
}
foreach ($this->getPages() as $page) {
if ($page['url']) {
$html .= '<li' . ($page['isCurrent'] ? ' class="active page-item"' : '') . '><a class="page-link" href="' . htmlspecialchars($page['url']) . '">' . htmlspecialchars($page['num']) . '</a></li>';
} else {
$html .= '<li class="disabled page-item"><span class="page-link">' . htmlspecialchars($page['num']) . '</span></li>';
}
}
if ($this->getNextUrl()) {
$html .= '<li class="page-item"><a class="page-link" href="' . htmlspecialchars($this->getNextUrl()) . '">'. $this->nextText .' »</a></li>';
}
$html .= '</ul>';
return $html;
}
from php-paginator.
Because the maintainer seems has gone away, i cloned this repo and add feature of bootstrap-4. Is here https://github.com/alexSivka/php-paginator . composer require sivka/paginator
from php-paginator.
We need bootstrap 4 pagination list item classes - should be easy to add.
https://www.w3schools.com/bootstrap4/bootstrap_pagination.asp
from php-paginator.
@markifornia that was clean.
from php-paginator.
@gorkijatt we might need to maintain this library if the author isn't active.
from php-paginator.
Okae i m in.
from php-paginator.
Replace the toHtml method with this one for bootstrap 4.1 with the breakpoints for the small template.
public function toHtml(){
if ($this->numPages <= 1) {
return '';
}
$html = '<ul class="pagination justify-content-center d-none d-md-flex">';
if ($this->getPrevUrl()) {
$html .= '<li class="page-item"><a class="page-link" href="' . htmlspecialchars($this->getPrevUrl()) . '">« '. $this->previousText .'</a></li>';
}
$pages = $this->getPages();
foreach ($pages as $page) {
if ($page['url']) {
$html .= '<li class="page-item' . ($page['isCurrent'] ? ' active' : '') . '"><a class="page-link" href="' . htmlspecialchars($page['url']) . '">' . htmlspecialchars($page['num']) . '</a></li>';
} else {
$html .= '<li class="page-item disabled"><span class="page-link">' . htmlspecialchars($page['num']) . '</span></li>';
}
}
if ($this->getNextUrl()) {
$html .= '<li class="page-item"><a class="page-link" href="' . htmlspecialchars($this->getNextUrl()) . '">'. $this->nextText .' »</a></li>';
}
$html .= '</ul>';
$html .= '<ul class="pagination justify-content-center d-md-none">';
if ($this->getPrevUrl()) {
$html .= '<li class="page-item"><a class="page-link" href="' . htmlspecialchars($this->getPrevUrl()) . '">« '. $this->previousText .'</a></li>';
}
$html .= '<li class="page-item"><select class="form-control paginator-select-page rounded-0">';
foreach ($pages as $page) {
if ($page['url']) {
$html .= '<option value="' . htmlspecialchars($page['url']) . '"' . ($page['isCurrent'] ? ' selected' : '') . '>' . htmlspecialchars($page['num']) . '</option>';
} else {
$html .= '<option disabled>' . htmlspecialchars($page['num']) . '</option>';
}
}
$html .= '</li></select>';
if ($this->getNextUrl()) {
$html .= '<li class="page-item"><a class="page-link" href="' . htmlspecialchars($this->getNextUrl()) . '">'. $this->nextText .' »</a></li>';
}
$html .= '</ul>';
return $html;
}
from php-paginator.
Any update?
from php-paginator.
I am trying to implement this class with mysql but no luck so far, can anbody help?
from php-paginator.
@alexSivka thank you for taking this package in under your wings.
I'll be sure to note any issues/feedback.
Cheers
Mark
from php-paginator.
Related Issues (9)
- alter function ceil per floor in updateNumPages HOT 1
- Is this Package is Maintained HOT 5
- Vague Documentation!!! No Guide on how to implement it in real world!! HOT 1
- Suppress link for current page in full width display
- about mysql example HOT 2
- Activated links
- Configurable Next and Previous text HOT 1
- build pages for toHtmlSemanticUI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-paginator.