logo

New Article Alerts Using CSS

New article alertYesterday I posted another new article. The second in the PHP series. The more I get in to this "series", the more I can see it getting longer and longer. So, I've created a new area of the Articles view called LAMP. Who would have thought it? Codestore has always been just Domino and now I introduce a whole new area! What can I say? Times change and I don't want to be the one left behind when/if Domino does eventually fade in to obscurity.

Following such a huge gap between new articles, I feel the need to alert you to them, as you've probably stopped checking long ago. To do this I now a) blog about it and b) highlight the new links in red. Anybody noticed? They return to normal link colour once you've looked at them! To do this I use two simple CSS rules. You might find them useful so I'll share them with you.

First thing to do is make sure the link has a class associated with. I called it "hotArticle":

<a class="hotArticle" href="unid/DOMT-5RXEAH?OpenDocument">A New Article</a>

Then I defined a CSS style rule to make these links red in colour:

a.hotArticle{
color:#f00;
}

Then I defined the :visited pseudo-class which makes sure the colour is like all other links after you've taken notice and looked at the article. Using a comma as the separator, I added this to the same definition as the normal link. This way, I only ever have to edit the "default" link colour in one place!

a, a.hotArticle:visited{
color:#09c;
}

Might come in useful on an intranet or something like it where you need to attract attention to hot news items....

Comments

  1. I don't know how codestore's setup (prob smarter than my site I'm certain) but I would do this:

    Your URLs are built with settings from the article document itself (which I would imagine that you're doing).

    I would create a computed field called IsHot, which I would set to the following:

    @If(

    @Today < @Adjust(PublishDate;0;0;14;0;0;0);

    "class=\"hotArticle\""; "")

    Now, when you're building your links, simply use the following syntax:

    "<" + "a href=\"" + link + "\" title=\"" + title + "\" " + isHot + ">" + display + "<" + "/a" + ">"

    (I hacked up the above because I didn't know what sort of replacement of strings you use on your postings...)

    Lastly, I would create a sleeper agent (run nightly) that basically runs through the documents in your articles view, finds ones where the isHot value is "class=\"hotArticle\"", check the date-publish date comparison and change the value if needed by calling your working agent to change the current document.

    That way you're allowing your users to view the articles "hot" for 14 days, switching it off if they've viewed the documents, but allow the document to reside there past 14 days (let's say a month, or your last 3 published) and not have to worry about confusing them if they drop their cache and history!

    I know... I'll shut up now ;-)

    -Chris

    • avatar
    • Jake
    • Thu 10 Jul 2003 11:16

    Chris. There is nothing at all fancy about my "hot links". I create the link text manually in a "setting" document called "Most Recent". I then do a lookup to it each time the page loads. Not pretty and not something I would use in practice but it does the job. The time-frame for how long an article remains "hot" is then completely down to me. Be it 7 days or 7 weeks.

  2. Actually, I don't blame you - why go into the development of that part of your website if you're the only one that needs to see/use it. If it works for you, then it's good enough.

    I just like to be able to show my friends how my site pretty much takes care of itself as far as stuff like that.

    Now if I can just get the blogs, articles and tips flowing...

    -Chris

    • avatar
    • mt69clp
    • Sun 10 Aug 2003 01:01

    no hot links for me :-(

    I tested it with Firebird and IE6, but never saw a red link.

    Anyway, the content is more interesting for me as the colors are...

    • avatar
    • Jake
    • Sun 10 Aug 2003 02:26

    If you don't see them it's more than likely a caching problem. Ctrl+F5.

    • avatar
    • mt69clp
    • Sun 10 Aug 2003 03:59

    it really WAS a caching problem :-)

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Tue 7 Oct 2003

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content