Optimized way to print "You" in a huge list

I have a contributor list in different pages on my website, when printing contributor list if logged in user is same with a contributor in list I should print "YOU". For every user check this does not make sense. What is best practice for this situation.

Note that : There are a lot of items in website. When you go to details of an item you see contributor list.

Answers


Perhaps you could distribute the load and put that logic in your page itself using jQuery. Let's say I'm logged in and my user ID is stored in a variable on the page called user_id. If you include the user ID in each element of the contributor list, you could do something like this...

$('li[id*="' + user_id + '"]').append(" (YOU)")

That would find every list element containing the user id and append the string (YOU) to it. It's still done on every page, but now the workload is distributed to each user's browser rather than on the server. Unless you have thousands of contributors, performance shouldn't be an issue.


Need Your Help

Getting number of hits from Google API

api search

I've tried to find a way to do this, but without success. I'm looking for a way to find out how many hits a search gets, and I don't want to do this manually, or with regex searching trough the htm...

Amazon Clouddrive API Android, invalid_scope error?

android amazon-web-services amazon amazon-clouddrive

Hey everyone I am getting this weird error. I try to log into the amazon cloud drive with my app, and I get invalid_scope? I have been looking for hours and I can't figure it out. Heres the kicker....