diff --git a/app/controllers/collection.php b/app/controllers/collection.php index 7196f5d..659b5e0 100644 --- a/app/controllers/collection.php +++ b/app/controllers/collection.php @@ -207,7 +207,7 @@ public function doIndex() { }'; } - x("pagesize", 10); + x("pagesize", $this->_server->pageSize()); } else { $row = null; @@ -335,7 +335,7 @@ public function doIndex() { //pagination $pagesize = xi("pagesize"); if ($pagesize < 1) { - $pagesize = 10; + $pagesize = $this->_server->pageSize(); } import("lib.page.RPageStyle1"); $page = new RPageStyle1(); diff --git a/app/models/MServer.php b/app/models/MServer.php index 4e4201e..484e433 100644 --- a/app/models/MServer.php +++ b/app/models/MServer.php @@ -24,6 +24,8 @@ class MServer { private $_docsNatureOrder = false; private $_docsRender = "default"; + private $_pagesize = 10; + /** * the server you are operating * @@ -99,6 +101,9 @@ public function __construct(array $config) { case "docs_render": $this->_docsRender = $value; break; + case "pagesize": + $this->_pagesize = $value; + break; } } if (empty($this->_mongoName)) { @@ -284,6 +289,16 @@ public function docsRender() { return $this->_docsRender; } + /** + * Get documents for page + * + * @return integer + * @since 1.1.8 + */ + public function pageSize() { + return $this->_pagesize; + } + public function auth($username, $password, $db = "admin") { if ($db === "") { if (!$this->_mongoAuth && $this->_mongoDb) { diff --git a/config.php b/config.php index 5dd3a9f..2200e7d 100644 --- a/config.php +++ b/config.php @@ -39,6 +39,8 @@ //$MONGO["servers"][$i]["docs_nature_order"] = false;//whether show documents by nature order, default is by _id field //$MONGO["servers"][$i]["docs_render"] = "default";//document highlight render, can be "default" or "plain" +$MONGO["servers"][$i]["pagesize"] = 10;//docs for page + $i ++; /**