Articles Anywhere also supports Pagination, offering the ability to split the returned articles in separate pages (similarly to what can be done with the Joomla! Category blog pages).
Pagination by Default
In the Articles Anywhere system plugin settings you can decide if you want to enable pagination by default. And you can define the default number of articles per page to be returned.
If you enabled pagination by default in the settings, but you don't want it in a specific instance of the {articles}
tag, you can individually disable it with:
{articles category="Animals" pagination="false"}...{/articles}
Pagination in individual tag
Alternatively, if you do not have pagination enabled by default in the settings, you can enable it in a specific instance of the {articles}
tag.
You can either make pagination use of the default number of articles per page from the settings, simply with:
{articles category="Animals" pagination="true"}...{/articles}
Or, for more control, you can individually define the number of articles per page in each {articles}
tag with a per_page="..."
attribute.
To return all articles from the category "Animals" and display 10 articles per page:
{articles category="Animals" limit="false" per_page="10"}...{/articles}
Thet limit="false"
attribute allows to not set a limit to the total amount of paginated articles, meaning all resulting articles will be displayed - divided in pages of course. This is set because, without it, the Default Limit set in the Plugin Settings would limit the total amount of articles returned.
Or you can of course combine this with a specified limit="..."
, to set a global limit of returned articles and then define the how many per page:
{articles category="Animals" limit="40" per_page="10"}...{/articles}
Other Settings
When using pagination, Articles Anywhere will add a parameter to the URL to generate pagination links and navigate between pages. By default, this is set to ?page=
(followed by the number of the page). The Page URL Parameter can be customized in the plugin settings.
In the plugin settings you can also set the position of the page navigation bar (between top, bottom, or both), and whether to show the pagination results information (such as "Page 1 of 4").
Multiple uses in one webpage
It's important to note that if on the same webpage you use multiple instances of the {articles}
tag with pagination, changing page in a set of articles would also change page in the other sets of articles. This happens because, by default, the Page URL Parameter is shared among all {articles}
tag uses.
To make sure that changing page in a set of articles doesn't affect the other instances, you can give each {articles}
tag its own unique Page URL Parameter by overriding it in the tag with a page_param="..."
attribute:
{articles category="Animals" limit="40" per_page="10" page_param="mypage"}...{/articles}
Note: If you're using Joomla cache (via Global Configuration, not via the System Plugin), you will need to register these additional URL Parameters as "safe", in order to make Joomla create a unique cache for each page. Articles Anywhere allows you to do this in the "Advanced" tab of the plugin settings (for each extra parameter name, you should also specify what type of value it can be).