468,275 Members | 1,859 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,275 developers. It's quick & easy.

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

SwissProgrammer
207 128KB
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.
Jun 11 '20 #1
7 5237
dev7060
419 Expert 256MB
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.
Jun 11 '20 #2
SwissProgrammer
207 128KB
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.
Jun 12 '20 #3
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?
Jun 19 '20 #4
SwissProgrammer
207 128KB
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.
Jul 8 '20 #5
SwissProgrammer
207 128KB
Anyone?

Thank you Otekpo Emmanuel. But, I am seeing this.that.what.now.more and seeing it as some .net stuff that I am trying to move away from. I used VS and .net for years and I am currently trying to use straight Stroustrup C++ without that stuff.

Please do not take this as a negative against you, but I have been learning to state at the beginning "No VS and No .net". You gave me an answer. Thank you. I must as for a better answer without that stuff.

Thank you.

Generic code that can be used outside of bytes.com. Thanks.

Anyone?
Jul 22 '20 #6
You are welcome SwissProgrammer. I hardly work with c++
Jul 22 '20 #7
SwissProgrammer
207 128KB
I really wanted this as a part of bytes.com.

Then, if bytes.com wants to tell us how it is done, and give us example code that does it, then we get to learn.

But, please bytes.com add this to your site pages.

Please.

Thank you.
Jul 22 '20 #8

Post your reply

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

Similar topics

2 posts views Thread by simonc | last post: by
reply views Thread by Anthony Nystrom | last post: by
reply views Thread by George2 | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.