Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you make links "highlighted" when unread..

Status
Not open for further replies.

altctrldel

Technical User
Jul 26, 2003
30
.. and then once it has been opened it is no longer highlighted? you know; like in our email inboxes when someone sends us a new unread email.

So basicly, I'd just have to send a query into the database, collect all the rows, order them by date (desc) so I'd have the latest row entred at the top.

so if unopened record = have a diff CSS, and then remove the special CSS after the user clicks on it.... but whats the code for php to determine that, that link hasn't been opened yet?

Still a noob ^^

thanks in advance.
 
All you have to do is specify a different color for a visited link in the HTML itself. Then make sure that each link has a unique URL. The browser will handle the color changes for you.

: Daniel :

-
 
You can do it purely with CSS

a:link
{
/* Insert properties here for an unclicked link */
}

a:visited
{
/* Insert properties here for a clicked link */
}

a:hover
{
/* Insert properties here for a hovered link */
}

a:active
{
/* Insert properties here for a clicked on link (like an onClick event)*/
}

-Kerry
 
thanks guys, but that still isn't the one I was looking for. Its a little more advanced than your regular visited and unvisited links. Because unlike your regular visited links, once you clean out your cache every link is going to go back to unvisited state. Whilst this one doesn't.
 
@ altctrldel
it seems what you are after is something akin to this forum. when you login the unread threads are highlighted and others are not. i assume you are working on some kind of story or bulletin board therefore.

to achieve this you would have to
+ identify the incoming user (use cookies to keep people "logged in")
+ keep references to all links in a database
+ keep a join table of users and link references. only insert rows into this table when a user reads a story
+ when page rendering for each link on the page, check whether there is a row in the join table and if so set its class to "read", otherwise set it to "unread".
+ create css directives for both read and unread to style them as you wish.

this isn't difficult to code so have a go and post back when/if you hit problems. the only difficult bit might be optimising the sql for record retrieval (shouldn't be too bad: feels like a single join) to ensure that the server overhead is kept in sensible limits as traffic increases.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top