Articles Anywhere 9.2 introduces the long-requested ability to use pagination for the returned articles, and much more.

Articles Anywhere is the powerful Joomla plugin that allows you to insert articles anywhere on your site based on any filters, place specific data (like title, text, images, custom fields, etc) and have full control over how you want to display the articles.

Version 9.2 has been released today. With the addition of pagination, Articles Anywhere now effectively allows you to completely make your custom blog layout views, taking what was perhaps the last "missing step" to fully use Articles Anywhere as a CCK.

Read below for a breakdown of what's new in the the latest update:

Pagination has arrived! PRO

Articles Anywhere 9.2 introduces the long-requested ability to use pagination for the returned articles, and much more.

For a long time, the addition of the Pagination feature for Articles Anywhere was requested by our users. And for just as long, the feature was considered and pondered. However, along with some technical hurdles, there were some complications and doubts:

What happens to the URL? What if you use it inside a module? What if you use it on the same page as a category blog that has its own pagination? Or what happens when using multiple {articles} tags with pagination on the same page? Etc...

Well, those days of wondering are over, and all those hurdles have been addressed, because Articles Anywhere now officially supports Pagination!

It's now possible to split the returned articles in separate pages, similarly to what can be done with the Joomla! Category blog pages.

Pagination

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.

In this case, Articles Anywhere will automatically add pagination to all your instances of the {articles} tag - of course only if the total number of articles returned exceeds the number of articles per page that you've set.

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" per_page="10"}...{/articles}

You can also combine this with the limit="..." attribute, 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}

Pagination Settings

In the Articles Anywhere system plugin settings you can:

  • Decide to have pagination enabled by default. If not, you can individually enable it in the tag with a per_page="..." attribute.
  • Define the number of articles per page to be returned if pagination is enabled by default.
  • Set the Position of the page navigation bar between top, bottom, or both (which can be overridden in the tag with pagination_position="top,bottom").
  • Select whether to show the pagination results information (such as "Page 1 of 4").
  • Customize the Page URL Parameter to use in pagination links.
Articles Anywhere - Pagination Settings

Multiple uses in one webpage

When using pagination, Articles Anywhere will add a parameter to the URL to generate pagination links and navigate between pages. By default, this parameter is set to ?page=, followed by the number of the page.

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.

So, how can you 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}

Joomla Cache & Registered URL Params

Now, of course, if the difficulties weren't enough, we ran into yet another complication: Joomla cache.

We discovered that when using the Global Configuration Cache (eg. Conservative caching), Joomla only allows certain "safe" URL Parameters to generate new cached pages (such as id, Itemid, lang, layout, view, etc). This meant that any other parameter wouldn't generate a unique cache and would serve the same cached page. In other words, Articles Anywhere pagination wasn't working with cache enabled.

But we found a way around that. We figured out how to register additional parameters as "safe", in order to make Articles Anywhere pagination work with cache enabled too.

Now, the default "Page URL Parameter" set in the Pagination settings (?page=, or whatever else you set there) has been automatically included as a safe parameter, meaning you will not have to do anything else to make it work.

However, if you give an {articles} tag another unique Page URL Parameter by overriding it with page_param="...", and if you're using Joomla cache, the pagination with that parameter won't work out of the gate. To make it work with cache, you will need to register these additional URL Parameters as "safe" as well.

So we built a way for you to do that. 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. For pagination params the input type should be set to UINT (which only allow positive numbers as the value).

registered url params

Note: you only need to worry about this if you're using the Joomla Cache under Global Configuration. If you use the "System - Page Cache" you won't have this problem, as that works by caching on a URL basis, so URL parameters will work correctly.

New Number Values PRO

As you probably already know, when using the multiple {articles} tag, Articles Anywhere offers several Number Values based on what place each article has in the list of articles. You can output the values via Data Tags, and you can also use them in If Structures.

These are useful to conditionally output html/content/data based on the dynamic values. Like the number of the article in the list. If it's the "first" or "last" article. Or if it is an "even" or "uneven" article.

The arrival of pagination brings some additions and changes to these Number values.

Numbers regardless of Pagination

Now, when using Pagination, the Number values will be based on the articles returned in the current page

To get the overall Numbers values regardless of pagination, you can append the respective Data Tag with a _no_pagination suffix.

  • [total_no_pagination] is the total number of articles returned before per_page is applied (regardless of pagination).

  • [count_no_pagination] is the overall number of the article in the list (regardless of pagination). So, if you show 10 articles per page, the first article in the second page will have a count value of 1, and a count_no_pagination value of 11.

  • [first_no_pagination] and [last_no_pagination] are true/false values based on whether the article is the overall first/last in the list (regardless of pagination). So the last value will be true for every last article in each page, while the last_no_pagination value will only be true for the very last article in the last page.

  • [previous_no_pagination] and [next_no_pagination] represent the number of the overall previous/next article in the list (regardless of pagination). This means that has_previous_no_pagination will only be false for the first article on the first page, and the has_next_no_pagination will only be false for the last article on the last page.

See the Numbers section of the documentation for a full explanation and more details.

Page Numbers

When using Pagination, you will also be able to output special pagination-based Number Values.

  • The [per_page] value contains the number of articles per page set to be returned.
  • The [pages] value contains the total number of pages generated by the results.
  • The [page] value returns the number of the current page.
  • The [previous_page] value gives the number of the previous page. This will return the number of the last page when the current is the first page.
  • The [next_page] value gives the number of the next page. This will return the number of the first page (1) when the current is the last page.
  • The has_next_page and has_previous_page values will return a true/false value based on whether there is a next/previous page. This means that has_previous_page will only be false for the first page, and the has_next_page will only be false for the last page.

And more...

Various other improvements and fixes, including:

  • Adds ability to override the adding of the ellipsis using the use_ellipsis="..." attribute
  • Adds ability to set a default "Include Child Categories" setting PRO
  • Fixes issue with html structure breaking when limiting text which contains divs by paragraphs
  • Fixes issue with input:... values containing special characters in default value not working PRO
  • Fixes issue with input:... values not working in ordering PRO

Read the Changelog for Articles Anywhere 9.2 for the full list of improvements and fixes that have been made in the new release.

The addition of Pagination comes on top of many other improvements that have been made to Articles Anywhere in the past months, including:

For a complete overview of all the features included in Articles Anywhere, head over to the full Documentation, and check out the Video Tutorials.