473,385 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Visited Links

This is not entirely a PHP question although it is based in PHP.

I have been creating a site, where I want the visitors to see the visited links as "Crossed Out" using CSS. However, I also want this effect to disappear after about 18 hours, so I used a PHP cookie to read when the last time the user visited the site was, and change the CSS so that the "visited" links had the same "Style" as the regular links. This seemed to work, however when you visited a new page, all the old "visited" links showed up again. Can you get rid of these? Or is there some other method?

In the header:
[php]
if (isset($_COOKIE[<CookieName>]))
$timeup="1"; //Cookie is present, apply visited style;
else
{
setcookie(<CookieName>, "VisitedToday", time()+72000, "/", "<WebsiteName>");
$timeup="0"; //Cookie is not present. Set Cookie;
}
[/php]
In the CSS
[php]
<?php
if ($timeup=="1")
{
echo "
.mmenus a:visited
{
color: black; font-family: arial; background-color: white; display: block; border-bottom: 1px solid black; font: 11px Sans-serif; font-weight: bold; text-decoration: line-through; text-align: center; height: 14px;
}";
}
else
{
echo "
.mmenus a:visited
{
color: black; font-family: arial; background-color: white; display: block; border-bottom: 1px solid black; font: 11px Sans-serif; font-weight: none; text-decoration: none; text-align: center; height: 14px; font-size: 10px;
}";
} ?>
[/php]
Nov 6 '06 #1
0 1396

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

Similar topics

3
by: Matt Adams | last post by:
As well known I could specify the text color in the body tag like: <BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE> What I want to achieve now is that always (!) the text of the last visited...
18
by: Jan Tuxen | last post by:
Jakob Nielsen in his most recent Alertbox (http://www.useit.com/alertbox/20040503.html) tells web authors to change the color of visited links. I agree to his purpose: Help users understand...
6
by: - jes | last post by:
Greetings. Using CSS, a programmer can set the color for an href link and a different color for a VISITED href link. Anyone know where this "list" of visited links is stored? Is it...
8
by: Chad | last post by:
Should links automatically appear in the "visited" color as defined by the user's IE settings without having to add any special coding? I have a situation where the link was not changing color...
1
by: Chad | last post by:
First visit all of the links on the page. For each, if the link opens a new window, close it. If it opnes in teh same window, hit back. then hit REFRESH. Notice that while all links SHOULd be...
8
by: Jeff | last post by:
ASP.NET 2.0 I'm wondering how to set the color of a visited HyperLinkField (the link text) in a GridView?? Here is the markup of the HyperLinkField I have problems with: <asp:HyperLinkField...
1
beacon
by: beacon | last post by:
I'm looking to reset the visited link color once another link is selected. Also, once that link takes me to a particular page, I want the font-weight for that page to be bold to indicate that it's...
2
by: jkizmannRU09 | last post by:
I know how to adjust the look of visited links with a CSS stylesheet, but how would one create individual variations among a set of links? For example, say I have three links, all initially...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.