By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,149 Members | 1,764 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,149 IT Pros & Developers. It's quick & easy.

How to add a counter for new content on a website?

P: 25
I thought about requesting that bytes.com do this, but this is an information & learning site, so I am asking of all readers how this can be done.

How many Questions have been added (which I have not clicked on thus removing them from the count) since I last "reset" the count?

How many Articles have been added (which I have not clicked on thus removing them from the count) since I last "reset" the count?

Currently:



Updated:



How to do that?

I log into bytes.com .

I see the count of Articles and Questions that I have not viewed.

If the count is larger than zero, then if I want to reset this count to zero, then maybe a little red button that does that.

No red button if there is no count above zero.

If I click on an Article or Question then the count goes down by one to no less than zero.

Whether bytes.com does this or not, how do you readers suggest that a site do this? You pick the language and you give an example of the code that does it. This is a learning site, so no pseudo-code please. Later viewers might use the code to guide them for their own site.

Thanks.
4 Weeks Ago #1
Share this Question
Share on Google+
4 Replies


dev7060
Expert 100+
P: 261
Whether bytes.com does this or not, how do you readers suggest that a site do this?
It can be done if a site has the public API. A custom made app can then make use of it.

For this site, I guess it is possible by using the sitemap with some custom js running on the client-side.
4 Weeks Ago #2

P: 25
Thank you dev7060.

I was thinking that a site could keep (on one of the the site's servers) records of this choice for each logged on user. The site could then dynamically create the page for each user. This is already being done in a similar manner when users post replies and edit replies. But, I want to see code from other programmers (not limited to use on bytes.com) would do this.

I am not asking, this time, for a client-side bit of code, but examples of server-side code.

Thank you.
4 Weeks Ago #3

P: 13
What bytes.com did is to count the number of questions asked by users. I don't know the kind of technique bytes.com used, but as for me, using simple sql count can solve this. Hope this helps?
3 Weeks Ago #4

P: 25
Anyone?

This is an amazing site, with some very experienced programmers. A little bit of code maybe. If later I have a site and I want to do similar, the I would like to be able to go back to this question and at least see a working example that I could learn from and possibly adapt to that need.



Thank you Otekpo Emmanuel. "but as for me, using simple sql count can solve this." Ok. Simple for you. I have sql. I am looking forward to your direct server-side code example. "Simple" for others here on this site sometimes has meant weeks of study for me when I could have learned so much quicker and been guided so much clearer by working examples. I am looking forward to your code.
6 Days Ago #5

Post your reply

Sign in to post your reply or Sign up for a free account.