When using exp:file:entries to output a list of files from a directory the pagination system does not work properly unless dynamic=“on”.
In order to list all the files from the directory (i.e. without a category url segment) one must use dynamic=“off” or dynamic=“no”.
I need to use dynamic=“no” to show a list of ALL files if no category or other dynamic info is being provided - as is standard practice.
It is possible to “work around” the problem by adding an additional url segment before the pagination segment.
For example, when listing 10 files at a time;
mysite.com/resources/P10 will incorrectly show the first 10 files (regardless of whether the third segment is P10, P20, P30)
whereas;
mysite.com/resources/foo/P10 will correctly show files 11-20
Sample code that demonstrates the problem:
{exp:file:entries directory_id="7" dynamic="no" limit="10" paginate="bottom"}
<h3>{title}</h3>
<p> {if description}{description}{/if}<br />
<a href="http://{file_url}">Download</a><br />
Categories: {categories backspace="6"}<a href="http://{path=resources}">{category_name}</a>, {/categories}</p>
<p> {paginate}<br />
Page {current_page} of {total_pages} pages {pagination_links}<br />
{/paginate}</p>
<p> {if no_results}<br />
There are no resources in this category.<br />
{/if}<br />
{/exp:file:entries}If I change the opening tag to
{exp:file:entries directory_id="7" dynamic="no" limit="10" paginate="bottom" paginate_base="resources/foo"}Then the problem disappears, although I now have duplicated content since /resources returns the same page as /resources/foo (which I really don’t want).
However, if the dynamic parameter is set to “on” or “yes”, for example when using categories, the pagination works properly.
I need to do some further testing before I submit a bug report but thought I’d post this here in case anyone can see something I’m doing wrong.
Note: the same methods that I’m using here work perfectly well when using {exp:channel:entries} so I don’t think I’m using categories/pagination incorrectly in my templates.