I have a section in my site where I display the 10 most popular posts. Now, I want to display a number, from 1 to 10, besides each post. Like this:
Top 10 posts
- post a
- post b
- post c
and so on…
I implemented a counter inside the while loop. I initialized the counter at 0 $counter = 0;
and then incremented it by one <?php echo ++$counter; ?>
My concern is, due to my site receiving thousands of visits a day, I want to know if this method will consume my site’s resources considerably. Is there a better way to do this? Maybe to implement some sort of caching?
What advice can you give me?
Another solution would be to use an ordered list.