summaryrefslogtreecommitdiff
path: root/core/models
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-01-04 09:28:57 +0000
committerBharat Mediratta <bharat@menalto.com>2009-01-04 09:28:57 +0000
commit7017e95c99d03bd43a1956fbc54ac2f85517d886 (patch)
tree1b5a1c41c58159f2c51051728270e44a23e8afd2 /core/models
parent83ae71e3cb0435c72b912ec490d8f8290dde4b7a (diff)
Allow passing a query string as an argument to Item_Model::url()
Diffstat (limited to 'core/models')
-rw-r--r--core/models/item.php12
1 files changed, 9 insertions, 3 deletions
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;
}
/**