An alternative to offest = “-1” in Expression Engine
-
30-06-2021 - |
Question
Does anyne know how expression engine deals with a negative offset in a list of channel entries in EE?
as in offset="-1"
No correct solution
OTHER TIPS
If you use offset="-1"
in {exp:channel:entries}
, you'll get a major MySQL error (assuming you're logged in as a super admin or are capable of seeing errors).
It's unclear what your goal is from your question. If you expect a negative offset to reverse the order (like PHP string functions), you can use use the opposite sort
value. The default is desc
, so sort="asc"
would be the reverse. Use a positive offset="X"
to skip X entries.
If you're expecting an offset
like in PHP array_slice where you're still going "forward" but a negative offset starts you X entries from the end, I don't believe there's a direct comparison.
The goal was to work with the preceding chanel entry on the same page as the current channel entry.
I managed to do it instead by pulling out the relevant entry_ids and processing them in php and then put them back in with a fixed_order attribute