Idea. There is a page:

Ссылка 1 Ссылка 2 

During the life cycle of the site, I add some content to it:

 Ссылка 1 Ссылка 2 (Новое!) Ссылка 3 

A user, entering the site, sees this inscription (New!), Understands that there is something new here, comes in, reads, then comes back and sees:

 Ссылка 1 Ссылка 2 Ссылка 3 

I hope explained the need clearly. Now the question is: how to implement it algorithmically? Only an idea comes to my mind for each registered user to start the isViewed flag, but something tells me that this is not the best option.

PS Site on the intranet, users are always logged in.

  • I think differently - heff
  • one
    You can make one table with all pages, and an adjacent table where many-to-many will be users-pages. - Daniel Protopopov
  • It would be possible for the user to record the date of the last transition to the "New" and the links the date of creation. But unfortunately it will help only if the link is one, as soon as it goes through the other “new”, the same goes out ... And there are a lot of links planned and is there a database where to fix it and, if so, which one? - Mike
  • @Mike links a lot, base ms sql. For each user, you need your own link status, if one looked, it does not mean that everyone looked - Sergey Tambovites
  • Then there is no other way out except for fixing id-references in a separate table. There is no user id. If there is no need to store any other information (such as voting for links, likes / dislikes), then the very fact of the presence of a record should be considered as "viewed". - Mike

2 answers 2

In general, you can make a special cookie. JS set up a new link design if there is no corresponding cookie, and record it on the client when visiting a given URL.

But I would think about the interface if I were you. If there is a list of news of some kind, then let it show the newest on top. And then the NEW button near the links is no longer comme il faut.

  • According to the statement of work, the documents should be sorted alphabetically, and if changes occur in them or new ones are added, such a mark should appear - Sergey Tambovtsev
  • @ sergeitambovtsev Well, TK means TZ :) Probably better to really make the "Users - Pages" correspondence table in the database. And add a flag to the pages, whether to look for such correspondences for them, otherwise all pages will be "new" until the first visit. Although it may be so. - Anton Melnikov

You can try to use the pseudo class CSS:

For example:

 a:link { color: #0000d0; /* Цвет ссылок */ } a:visited { color: #900060; /* Цвет посещенных ссылок */ }