ASP code for library hours

December 20, 2007

Today I spent most of my day writing an ASP code from scratch that will display our hours based on the date. While this sounds simple, here are the steps I followed:

  • Set a variable today as Date()
  • Declare the base rule for the three days we have the same hours.
  • Set exceptions by day of the week above that
  • Set our closed for the holiday dates above the standard hours
  • Set our finals hours above those

Since ASP executes in a logical “If..Elseif…Else..End if” statement, this works. However, I then realized one fact: we’re open past midnight at times. I don’t want the next days hours to start until 1:00am. A quick chat with our campus ASP person to figure out what to do and some creative errors (don’t we learn best by errors?) I was able to declare the following statement:

If Time() < “01:01 AM” then
today = DateAdd(“d”,-1,today)

Update:

Dim miltime
miltime = FormatDateTime(today,4)
If miltime < “01:01:00″ Then
today = DateAdd(“d”,-1,today)

This says that if it’s before 1:01am, then subtract one day from the date, effectively turning back time.

Easy enough, eh? Well, I decided I didn’t like the standard time display “Wednesday, December 19, 2007.” So, I used some more ASP to break it apart and display the Month, Day and a new variable called ord which stands for the ordinal number contraction (st, nd, rd, th). I threw that in an If..Then statement right after the time statement but before the hours designation. All in all, it worked out.

Bottom line: Email me if you want the code: libguy@libguy.info.


Database description/link maintence: how we do it.

October 11, 2007

Keeping databases and descriptions up to date can be a daunting task. While lots of places use ASP and an mdb, we’re doing it slightly different – with includes. Yes, it’s more work, but it’ll work out easier for the technical abilities of other librarians here.

  1. Each database is stored in a .html file with the html coding and description for that database.
  2. In the code for the web page on whichi we wish to display the database we use a <!–#include –> command to include the text from that file.
  3. Updating the .htm for the database will automatically update it on each page where that database is listed.

It works for us, since we don’t feel like getting deep into SQL and ASP. If you want, I can share the procedure from the beginning to the end.


RSS in your webpage

October 10, 2007

RSS feeds are great ways for patrons to access your page without actually accessing your page. They can keep up to date on everything in a blog simply by subscribing to the blog. While they may not see any pretty pictures, they will read (like plain text email) everything that you put in your blog. It’s simple, too!

Here’s all it takes to make firefox (and other browsers) recognize the fact that your page has an RSS feed:

In the <head> tag:

<link rel=”alternate” type=”application/rss+xml” href=”{URL of your feed}” />

Start using it today!

On another note, look at how nice it is in upstate New York in the Fall:

Outside the library

Outside the library 2