Sorting in Smarty

I’m using a site that was built using Smarty. I didn’t type the code myself and I’m not very familiar with it so I’m hoping someone could help me out here.

The site has posts (confessions) and people are able to leave comments, but the comments sometimes appear out of order. I would like to have them sorted in ascending order either by their child id or by date.

Here’s what I want to fix:


The answer might come from one of these,

Parent ID


Time Ago in Smarty:


Thank you

Well if those comments are coming from the database you really should consider adding sorting to the query that generates comments. Sorting the comments in a smarty template is dirty and introduces logic that really has no place at the presentation layer. The sorting should either be done outside the smarty template or ideally within the query itself to generate the comments.