diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-04 09:28:57 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-04 09:28:57 +0000 |
commit | 7017e95c99d03bd43a1956fbc54ac2f85517d886 (patch) | |
tree | 1b5a1c41c58159f2c51051728270e44a23e8afd2 | |
parent | 83ae71e3cb0435c72b912ec490d8f8290dde4b7a (diff) |
Allow passing a query string as an argument to Item_Model::url()
-rw-r--r-- | core/helpers/core_menu.php | 2 | ||||
-rw-r--r-- | core/models/item.php | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/core/helpers/core_menu.php b/core/helpers/core_menu.php index 29de486e..8316aa1f 100644 --- a/core/helpers/core_menu.php +++ b/core/helpers/core_menu.php @@ -90,7 +90,7 @@ class core_menu_Core { ->append(Menu::factory("link") ->id("album") ->label(_("Return to album")) - ->url("{$theme->item()->parent()->url()}?show={$theme->item->id}") + ->url($theme->item()->parent()->url("show={$theme->item->id}")) ->css_id("gAlbumLink")); } diff --git a/core/models/item.php b/core/models/item.php index 6f56e726..a684b713 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -105,13 +105,19 @@ class Item_Model extends ORM_MPTT { /** * album: url::site("albums/2") * photo: url::site("photos/3") + * + * @param string $query the query string (eg "show=3") */ - public function url() { + public function url($query=array()) { if ($this->is_album()) { - return url::site("albums/$this->id"); + $url = url::site("albums/$this->id"); } else { - return url::site("photos/$this->id"); + $url = url::site("photos/$this->id"); + } + if ($query) { + $url .= "?$query"; } + return $url; } /** |