Skip to content

Instantly share code, notes, and snippets.

@brandonkelly
Created February 17, 2014 23:35
Show Gist options
  • Save brandonkelly/9061498 to your computer and use it in GitHub Desktop.
Save brandonkelly/9061498 to your computer and use it in GitHub Desktop.
Add a craft.request.getPageNum() function to Craft
diff --git Source/craft/app/variables/HttpRequestVariable.php Source/craft/app/variables/HttpRequestVariable.php
index fad31b7edab84f5c428e3ce2c3b3ec6e8d92e7ef..430e1adcdf801cccabaf67c89001465c8835fba7 100644
--- Source/craft/app/variables/HttpRequestVariable.php
+++ Source/craft/app/variables/HttpRequestVariable.php
@@ -201,4 +201,14 @@ class HttpRequestVariable
{
return craft()->request->isMobileBrowser($detectTablets);
}
+
+ /**
+ * Returns the page number if this is a paginated request.
+ *
+ * @return int
+ */
+ public function getPageNum()
+ {
+ return craft()->request->getPageNum();
+ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment