Marcher Technologies Posted February 15, 2013 Share Posted February 15, 2013 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. Link to comment Share on other sites More sharing options...
Michael Posted February 15, 2013 Share Posted February 15, 2013 Seems like it would be something that could be easily included in IPSLib for easy re-use in other products. Link to comment Share on other sites More sharing options...
stoo2000 Posted February 15, 2013 Share Posted February 15, 2013 I did wonder about this, seems silly to keep reproducing the same method. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.