Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How to limit the max amount of views displayed in a question?

+1 vote
76 views
asked Sep 6 in Q2A Core by Ronlaw
I want to display question views but only to a certain limit. For example:

Question A: 340 views

Question B: 1,000+ views

I think it's important to hide your most visited pages from competitors. Keyword competition in Google results can be brutal. But I still want users to know which questions are most visited.
Q2A version: Latest

1 Answer

+1 vote
answered Sep 20 by jatin.soni

If you have fixed maximum number than the easiest (may not be the perfect) way to do is just check conditionally with the max number and show unless it is lower than that else display your max number. 

Here is the simple logic. Of course, you will have to change variable and figure you want.

if ($viewCount < 1000) {
	//show view count as it is
} else {
	//show view count 1000+
}
commented Sep 20 by Ronlaw
Thank you. That helps.
commented Sep 21 by JonPerkis
OH 0_0
I didn't know that i can use this option :) Thank you, guys!
...