- Joined
- Feb 17, 2023
- Messages
- 7
- Points
- 3
Reputation:
Hello,
I was wondering how I can achieve the option to sort in reverse (desc) the posts in a specific thread.
I was playing around in the thread_view template and post_macros.
The hard part is to get the reverse, I've tried numerous options such as:
or
However, nothing works. I was wondering if someone did this and can give me an idea, thanks.
I was wondering how I can achieve the option to sort in reverse (desc) the posts in a specific thread.
I was playing around in the thread_view template and post_macros.
The hard part is to get the reverse, I've tried numerous options such as:
Code:
{set $sortedPosts = $posts|sort_by('post_date', 'desc')}
<xf:foreach loop="$posts|reverse" value="$post">
<xf:foreach loop="$posts" start="{{ count($posts) }}" end="1" step="-1" value="$post">
or
Code:
<xf:foreach loop="$posts" from="{$posts|length}" to="1" step="-1" value="$i">
<xf:set var="$post" value="$posts[$i - 1]" />
the post macro here
</xf:foreach>
However, nothing works. I was wondering if someone did this and can give me an idea, thanks.