We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Reverse These!

Development and Programming

Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

The attached add-on files may be out of date. Please visit Devot-ee for the latest versions.

This plugin enables you to reverse the order of the series of items.

Why such functionality is needed?

For example, you may need to display 10 most recent comments in ascending order. But exp:comment:entries tag allows only to set “sort” parameter value either to “asc” or “desc”. So, after setting “orderby” parameter to “date” and “sort” to “desc” you will get 10 most recent comments but they will be ordered not as you need. To order them as needed their order should be reversed. Here Reverse This plugin comes to your help.

PARAMETERS

No parameters.

VARIABLE PAIR

1) {reverse_these_item}{/reverse_these_item} - any item in the series of items which should be reversed must be wrapped with this variable pair.

USAGE

This code will output latest 10 comments in ascending order.

{exp:reverse_these}

{exp:comment_entries entry_id="531" limit="10" orderby="date" sort="desc"}

{reverse_these_item}
{count}{comment}
{/reverse_these_item}

{/exp:comment_entries}

{/exp:reverse_these}
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.