2005-02-16 23:46 GMT by faithless
On this page... (hide)
Step #1: javascript code
Insert this javascript code in the header section (<head></head>), of the page where you want your news to appear.
<script language="javascript">
function ReadCookie(name) {
var CheckCookie = name + '=';
var Cookies = document.cookie.split(';');
for (var i = 0; i < Cookies.length; i++) {
var c = Cookies[i];
while (c.charAt(0) == ' ') {
c = c.substring(1,c.length);
}
if (c.indexOf(CheckCookie) == 0) {
return c.substring(CheckCookie.length,c.length);
}
return null;
}
function SaveCookie(name) {
var date = new Date();
date.setTime(date.getTime()+(360*24*60*60*1000));
var expires = date.toGMTString();
document.cookie = name + '=yes;expires=' + expires + ';path=/';
}
</script>
Step #2: Modify News Style
Insert this at the top of your news style.
<PerlCode>
$jsid = $newstime;
$jsid =~ s/,//g;
</PerlCode>
Step #3: More style modifications
Insert this where you want the "NEW" text to appear in your news style.
<script language="javascript">
var Cookie = ReadCookie('<Field: jsid>')
if (Cookie == null) {
document.write('<font color="red">NEW</font>');
SaveCookie('<Field: jsid>');
}
</script>
Replace NEW text with Image
To use an image instead of the red "NEW" text example shown here, change the document.write line to:
document.write('<img src="
20" height="10">');
To use with Maginot Static Page
For use with Maginot Static Pages and headline profiles, you would have to modify each step a bit. Ignore this portion if you do not use Maginot Static Pages. Complete steps 1 and 2 as indicated for each Maginot Static Pages profile and its "linked" headlines profile you want to have the "NEW" indicator.
In the headline profile, change the code for step 3 to:
<script language="javascript">
var Cookie = ReadCookie('<Field: jsid>')
if (Cookie == null) {
document.write('<font color="red">NEW</font>');
}
</script>
Then, in the "linked" Maginot Static Pages profile, change the code in Step 3 to:
<script language="javascript">
var Cookie = ReadCookie('<Field: jsid>')
if (Cookie == null) {
SaveCookie('<Field: jsid>');
}
</script>
This way, the news will only be marked as "read" only if your visitor clicks and view the full Maginot Static Page news.
Step #4: Fulll rebuild
Now, do a Full Rebuild and you're done!
Categories:
