diff options
author | Chad Kieffer <ckieffer@gmail.com> | 2009-11-15 00:38:59 -0700 |
---|---|---|
committer | Chad Kieffer <ckieffer@gmail.com> | 2009-11-15 00:38:59 -0700 |
commit | 11f5560713e3597df772cbdd9bae5a5f638ee870 (patch) | |
tree | 662df437d2d8e6c6ec8a81faf8fd99f8c36b23f7 /modules | |
parent | a6f1d3ad44a658dc4f813d96735d033248e4de89 (diff) | |
parent | 967b17204b4e038fa2181473e80fcba143d30970 (diff) |
Merge branch 'master' of github.com:gallery/gallery3
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/libraries/Theme_View.php | 11 | ||||
-rw-r--r-- | modules/search/controllers/search.php | 5 |
2 files changed, 10 insertions, 6 deletions
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 19dc0829..b5546a43 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -148,20 +148,19 @@ class Theme_View_Core extends Gallery_View { $v->next_page_url = null; $v->last_page_url = null; - if ($this->page_type == "album" || $this->page_type = "tag") { + if ($this->page_type == "album" || $this->page_type == "tag") { $v->page = $this->page; $v->max_pages = $this->max_pages; $v->total = $this->children_count; - $model = $this->page_type == "album" ? $this->item : $this->tag; if ($this->page != 1) { - $v->first_page_url = $model->url(); - $v->previous_page_url = $model->url("page=" . ($this->page - 1)); + $v->first_page_url = url::merge(array("page" => 1)); + $v->first_page_url = url::merge(array("page" => $this->page - 1)); } if ($this->page != $this->max_pages) { - $v->next_page_url = $model->url("page=" . ($this->page + 1)); - $v->last_page_url = $model->url("page={$this->max_pages}"); + $v->next_page_url = url::merge(array("page" => $this->page + 1)); + $v->last_page_url = url::merge(array("page" => $this->max_pages)); } $v->first_visible_position = ($this->page - 1) * $this->page_size + 1; diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php index 08128ae8..cf9e271f 100644 --- a/modules/search/controllers/search.php +++ b/modules/search/controllers/search.php @@ -30,7 +30,12 @@ class Search_Controller extends Controller { } list ($count, $result) = search::search($q, $page_size, $offset); + + $max_pages = max(ceil($count / $page_size), 1); + $template = new Theme_View("page.html", "search"); + $template->set_global("page", $page); + $template->set_global("max_pages", $max_pages); $template->set_global("page_size", $page_size); $template->set_global("children_count", $count); |