Navigation

Search

constructPageIndex

Description

Builds the page list, e.g. 1 ... 6 7 [8] 9 10 ... 15.

Syntax

string constructPageIndex (string $base_url, int &$start, int $max_value, int $num_per_page[, bool $flexible_start])



Parameter $base_url

Expected type: String
Description: The URL without the "start" value (example: $scripturl . '?board=' . $board)



Parameter &$start

Expected type: Integer
Description: The start value - this number determines what page we're on (usually a multiple of the num_per_page parameter)



Parameter $max_value

Expected type: Integer
Description: The maximum possible value for $start (tells the function when to stop...)



Parameter $num_per_page

Expected type: Integer
Description: The (maximum) number of items that should be displayed on each page (as determined by an appropriate setting - max topics per page, max posts per page, etc.)



Parameter $flexible_start

Expected type: Boolean
Description: Determines whether or not to use the "compact" start value (ie .../index.php?board=1.0 vs .../index.php?board=1;start=0) - default is false



Return value

Expected type: String
Description: The constructed page index


Notes

  • Compact_start causes it to use "url.page" instead of "url;start=page".
  • Handles any wireless settings (adding special things to URLs.)
  • Very importantly, cleans up the start value passed, and forces it to be a multiple of num_per_page.
  • Also checks that start is not more than max_value.
  • Base_url should be the URL without any start parameter on it.
  • Uses the compactTopicPagesEnable and compactTopicPagesContiguous settings to decide how to display the menu.
  • An example is available near the function definition
View all versions of this function