From 220d903b74c52ed2fc767661ec69938477eda76f Mon Sep 17 00:00:00 2001 From: Nick Tsai Date: Tue, 25 Dec 2018 11:54:42 +0800 Subject: [PATCH 1/4] Update README.md --- README.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d8a7204..5fea997 100644 --- a/README.md +++ b/README.md @@ -236,14 +236,27 @@ echo Pagination::widget([ #### Customized View -The default widget view is for Bootstrap(`bootstrap`), you could customized your pagination view then set into Pagination Widget. +The default widget view is for Bootstrap(`bootstrap`), you could choose a template view for your Pagination Widget: ```php -use yidas\widgets\Pagination; +echo \yidas\widgets\Pagination::widget([ + 'pagination' => $pagination, + 'view' => 'simple', +]); +``` -echo Pagination::widget([ +|Template |Description| +|:--------|:----------| +|bootstrap|Default view, supports for Bootstrap 3 and 4| +|simple |Simple `
` with `` tags for pure HTML/CSS style| + + +You can also use your customized view for Pagination widget: + +```php +echo \yidas\widgets\Pagination::widget([ 'pagination' => $pagination, - 'view' => $appPagerViewPath, + 'view' => __DIR__ . '/../widgets/pagination_view.php', ]); ``` @@ -426,7 +439,7 @@ API DOCUMENTATION |$pageCssClass|string |The CSS class for the each page button, default value is `page-item`| |$ulCssClass |string |The CSS class for the ul element of pagination. For example, 'pagination-sm' for Bootstrap small size.| |$linkAttributes|array |HTML attributes for the link in a pager container tag, default value is ['class' => 'page-link']| -|$view |string |The view name or absolute file path that can be used to render view. (Template: `bootstrap`, `simple`)| +|$view |string |The view name or absolute file path that can be used to render view. ([Template view choices](#customized-view))| --- From 4db7f3514f0f2ab414fc35491f57991009d79661 Mon Sep 17 00:00:00 2001 From: Nick Tsai Date: Tue, 25 Dec 2018 11:55:36 +0800 Subject: [PATCH 2/4] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 5fea997..acf80d2 100644 --- a/README.md +++ b/README.md @@ -260,8 +260,6 @@ echo \yidas\widgets\Pagination::widget([ ]); ``` -> You could also choose library's template view: `bootstrap`, `simple` - #### Inheritance You could build your application Pagination Widget with styles Inherited from `yidas\widgets\Pagination`. For example: From 7b73caf384d61e4ffb1c8b94e45d1b1ffaeafdfa Mon Sep 17 00:00:00 2001 From: Nick Tsai Date: Fri, 1 Feb 2019 18:11:24 +0800 Subject: [PATCH 3/4] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index acf80d2..0099c93 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ PHP Paginator with Pager Widget (pure PHP, CI, Yii, Laravel support) [![Latest Stable Version](https://poser.pugx.org/yidas/pagination/v/stable?format=flat-square)](https://packagist.org/packages/yidas/pagination) -[![Latest Unstable Version](https://poser.pugx.org/yidas/pagination/v/unstable?format=flat-square)](https://packagist.org/packages/yidas/pagination) [![License](https://poser.pugx.org/yidas/pagination/license?format=flat-square)](https://packagist.org/packages/yidas/pagination) Features From 506e01ab64188886f243f02adce46cf88f8517e7 Mon Sep 17 00:00:00 2001 From: cake0852 <36023578+cake0852@users.noreply.github.com> Date: Mon, 6 Sep 2021 14:40:45 +0800 Subject: [PATCH 4/4] [Patch] Optimization CreateUrl() --- src/data/Pagination.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/data/Pagination.php b/src/data/Pagination.php index bb4282b..9ab3085 100644 --- a/src/data/Pagination.php +++ b/src/data/Pagination.php @@ -179,12 +179,15 @@ public function createUrl($page, $prePage=null) { $requestUri = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); // Add or reset page parameter - $_GET[$this->pageParam] = (int) $page; + $isPage = (int) $page; + $ppParam = ''; if ($this->perPageParam) { - $_GET[$this->perPageParam] = ($prePage) ? $prePage : $this->perPage; + $isPerPage = ($prePage) ? $prePage : $this->perPage; + $ppParam = "&{$this->perPageParam}={$isPerPage}"; } + // Build URL - $url = "//{$_SERVER['HTTP_HOST']}{$requestUri}?" . http_build_query($_GET); + $url = "//{$_SERVER['HTTP_HOST']}{$requestUri}?" . http_build_query($_GET) . "&{$this->pageParam}={$isPage}{$ppParam}"; return $url; }