Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted February 15, 201311 yr http://www.invisionpower.com/support/guides/_/advanced-and-developers/miscellaneous/34-migrating-from-st-to-page-r231 You'll likely want to add a helper method like so: :unsure: .... is there a reason there isn't some standard methods in the output class or IPSLib as it is really basic code you ask us to add to every script using paging repeating the same thing over again? /** * Coverts a page number to a start value * @param int $page * @param int $perPage */ public function pageToSt( $page, $perPage ) { $page = intval( $page ); $perPage = intval( $perPage ); return ( $page > 1 ) ? ( ( $page - 1 ) * $perPage ) : 0; } /** * Coverts a st value to a page number * @param int $page * @param int $perPage */ public function stToPage( $st, $perPage ) { $st = intval( $st ); $perPage = intval( $perPage ); return ( $st > 0 ) ? ( ceil( $st / $perPage ) + 1 ) : 1; } :flowers: Just asking, not like I could depend on such being there now... just is annoying to have the same methods rolled into every script to call them.
February 15, 201311 yr Seems like it would be something that could be easily included in IPSLib for easy re-use in other products.
Archived
This topic is now archived and is closed to further replies.