diff --git a/README.md b/README.md
index d8a7204..0099c93 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,6 @@
PHP Paginator with Pager Widget (pure PHP, CI, Yii, Laravel support)
[](https://packagist.org/packages/yidas/pagination)
-[](https://packagist.org/packages/yidas/pagination)
[](https://packagist.org/packages/yidas/pagination)
Features
@@ -236,18 +235,29 @@ 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 Pagination::widget([
+echo \yidas\widgets\Pagination::widget([
'pagination' => $pagination,
- 'view' => $appPagerViewPath,
+ 'view' => 'simple',
]);
```
-> You could also choose library's template view: `bootstrap`, `simple`
+|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' => __DIR__ . '/../widgets/pagination_view.php',
+]);
+```
#### Inheritance
@@ -426,7 +436,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))|
---
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;
}