1

I am using an add-on that that outputs a list of messages.

As is the same with the other native ExpressionEngine tags, it is dependent on the pagination value on the URL to determine the offset.

The problem lies in a specific use case where if no "P" value is set in the URL, I want the add-on to get the "10 latest messages". Since 'P' value is not available, I don't know if the "10 latest message" is possible to get.

I was thinking if there is a way to set the "P" value when page is just starting to load.

Is there a way to do this? If not, any suggested alternatives to this issue?

1 Answer 1

2

Is the list of messages sorted, with the "10 latest messages" first (sort on date, descending), or last (sort on date, ascending)?

If the "10 latest messages" are first, they should be on the first page of results--which would be the URL with no P, or with P0.

In any case, if you know the offset--say you want messages 90-100, the channel entries tag Offset parameter lets you do that. E.g.,

offset="90" limit="10"
3
  • Yep. It is to sorted to 'desc' based on the timestamp of the message. So I get the "10 latest messages". However, when outputting the results to the page, I need to display them in the reverse order so that the latest message is on the bottom and the earliest one is on the top. Aug 16, 2013 at 5:18
  • Because you're using one sort, descending, to determine the "10 latest messages," I can't think of any way to apply a second sort, ascending, within the same tag. You need another tag/operation, wrapped around your results. I'd try something like a Stash list to capture your results, and then output them using it's own sort.
    – Jay F
    Aug 16, 2013 at 6:45
  • Yeah. After researching about this problem a bit more, I came to the same conclusion. The add-on that I am using is currently not able to support offset so passing offset is useless. Aug 16, 2013 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.