User:Mathglot/sandbox/Templates/nth view
2024-06-25:481
Return the nth view item (date:value) from a page containing data downloaded from the pageviews tool.
Usage
{{nth view|Talk:ArticleName/pageviews|number}}
Parameters
|1=
– name of a Talk subpage containing page views data dumped from the tool.
|2=
– which item is requested: legal values: 1 to max number of data items in the file
Examples
{{nth view|Talk:Liberation of France/pageviews|3}}
⟶ 2024-06-25:481{{nth view|Talk:World War II/pageviews|5}}
⟶ 2024-07-13:28296{{nth view|Talk:House of the Dragon/pageviews|2}}
⟶ 2024-06-02:25160{{nth view|Talk:Cleopatra/pageviews|7}}
⟶ 2024-07-31:141849
Notes
In a page views download data file, each page-view item is a data pair on a line by itself, consisting of one date and one statistic separated by one blank (e.g., 2024-06-01 533
). For easier handling in template-land, the data file page view data (i.e., the whole file less the column headers) are slurped into one long comma-separated string (without newlines) permitting easy access of one item by template {{Array}}. Each data item returned by this template has a colon supplied, where there was a blank before; this is again a bow to template issues, where blanks can sometimes be problematic. So, retrieving the 10th array item will return the 10th page view item (in line 11 of the file) and return a page view item like this: 2024-06-01:533
for downline processing.