14.5 Element Counters in Files

The position of the tree unit element being formatted in its file or the total number of elements output to a file is interesting, for instance to format end of files, decide which navigation header or footer is needed and whether a rule should be output.

To get information on tree elements unit counter in files, use count_elements_in_filename:

Function: $count = $converter->count_elements_in_filename ($specification, $file_name)

Return tree unit element counter for $file_name, or undef if the counter does not exist. The counter returned depends on $specification:

current

Return the number of unit elements associated with $file_name having already been processed.

remaining

Return the number of unit elements associated with $file_name that remains to be processed.

total

Return the total number of element units associated with the file.