Downloadable Software

What's New?

New/changed file list

Pregnant Pause Home Software Search this site


Download You may have to shift-click or right-click to be able to save it to your local drive.

But we recommend you read the instructions ...

Capsule description

Whatsnew is a PHP program that displays a list of new and changed files on your website. The user can ask for all the files that have been added or changed in a specified number of days, or since the last time he came to this screen.

Note: Whatsnew is written in PHP. You must have PHP available on your web server to use this. If you aren't sure whether or not you have PHP, here's an easy way to find out: Drop this program on your web site. Then type in the URL to get to it. If it displays a program listing, you don't have PHP. If it displays a list of updated files, you do. PHP is available for free (my second favorite price -- right after "they pay you to take it") from www.php.net.

License

This software is free. But as a non-profit organization, we would appreciate a donation!

Software and documentation (this page) Copyright 2003 by Jay Johansen.

In the following, the word "product" refers to both the software and the documentation, that is, both the whatsnew.php file and this text file, jointly or separately.

Why we wrote Whatsnew

Our web site is getting large and some number of people visit repeatedly. It seemed like a nice idea to give them an easy way to find what files had been added or changed since their last visit, so they don't have to search through menus looking for new stuff.

Installation

That's it!

Well, if you want some more control, there are some options.

Using Whatsnew

By default, Whatsnew will give the user a list of all the files that it finds on your web server with extensions of "htm", "html", or "pdf" that have changed since the user last came to the Whatsnew page, or in the last 14 days if they've never been here before or the program can't figure out when they've last been here. The user can then give a different date range and re-run the query. The results are displayed in a rather bland format.

Note: These instructions assume you have a basic familiarity with HTML. If you need help on HTML there are plenty of sources on the Web, we don't need to repeat it here. See, for example, Getting Started With HTML.

The program is written in PHP. You don't need to know PHP to use it. You don't need to modify the program file to take advantage of most options. You must edit the program file if you want to change the look of the screen, but this still doesn't require you to know PHP. The screen layout has deliberately been put at the bottom of the file, separated out from all the PHP code, and the screen is in plain vanilla HTML, except for the spots where you insert values generated by the program, and we'll tell you how to do that in just a moment.

Link options

A user will normally get to the Whatsnew page from a link off some other page on your web site. If you simply take them to the program file with no parameters, they get the default behavior described above. If you prefer, you can add parameters to the link. The following parameters are recognized:

since
"v" to give list of files changed since the user's last visit. "d" to give list of files changed within a specified number od days. (If you specify "v" and Whatsnew can't figure out when they last visited, it falls back to "d".)
days
Number of days to use if "since=d". (Or if "since=v" and we had to fall back to "d".)

See also: Limiting paths

(We didn't say there were a lot of parameters!) Parameters are given as for a standard HTML "get" request, that is, follow the program name with a question mark (?), give a parameter name, an equal sign (=), and a value, and separate multiple paramters with ampersands (&). For example:

<a href="/somedir/whatsnew.php?since=d&days=30">

Limiting paths

By default, Whatsnew searches your entire site for new or updated files. That is, it searchs all files and directories beneath your document root. It does not find files by searching for links in other files -- it reads your directory, and will find everything that turns up in Windows Explorer (for Windows) or from an "ls" command in Unix or Linux.

You can restrict the paths that Whatsnew will search using a "robots.txt" file. The "Robot standard" is a convention used by many Web search engines to limit where they search on a web site. If you are familiar with robots.txt for use with search engines, it works the same way with Whatsnew. If not, here's a capsule explanation of the standard.

Create a file named "robots.txt" in the root directory of your web site. This must be a plain text file, typically created with Notepad (Windows) or vi (Unix). This file contains two kinds of lines (that Whatsnew cares about -- there are a couple of others that we won't get into here).

A header line begins with the label "user-agent:", followed by at least one space, and then the name of a user agent. Whatsnew responds to the name "whatsnew" (surprise!) or to the generic name "*". (All programs that read robots.txt will match against an "*".) Everything below that header line up to the next header line applies to the named user agent. If there is both a "whatsnew" section and an "*" section, Whatsnew respects whichever comes first. (If you include an "*" section in your robots.txt file, it should always come last, as nothing is going to keep looking after that.)

Example:

user-agent: whatsnew

A disallow line beings with the label "disallow:", followed by at least one space, and then the prefix of a path that you don't want the last-named user agent to search. Do not give a full URL, just the path portion, that is, don't give a protocol or domain name. Any path that begins with this prefix is skipped.

Example:

disallow: /bob/test

Note that this is not interpreted as a directory name: it is simply a character string. Thus, the above example would exclude a file named "/bob/test/newversion.htm" as you would probably expect. It would also exclude "/bob/test3.htm", because this also begins with "/bob/test". If you want to block a directory without blocking individual files that coincidentally begin with the same character string, end the disallow string with a slash, as:

disallow: /bob/test/

So here's a complete example:

user-agent: google
disallow: /cgi-bin/
disallow: /test/
disallow: /mary/private/
user-agent: whatsnew
disallow: /test/
disallow: /in-work/
user-agent: *
disallow: /test/
disallow: /cgi-bin/

In the above example, Google will respect the first block of disallows, Whatsnew will respect the second, and anything else that reads a robots.txt file will respect the last.

Note that there is no way in the Robot standard to specify a "pattern" other than a prefix. Specifically, something like "disallow: /medical/*.pdf" won't work.

Programmer's note: You may wonder why we put the directory restrictions on Whatsnew in robots.txt instead of putting them as parameters in the link. Maybe this was a bad idea, but we figured that we'd already created a robots.txt file to control access by the search engines, and if this ever needs to change, we've kept the restrictions in one place, so we're less likely to fix one place and forget the other.

Customizing the web page

As noted earlier, the bottom section of the program file is mostly ordinary HTML describing the page that surrounds the results. Feel free to edit this to make it fit in with the flavor of your site: Use your colors or background, add your menus, etc.

There are a few "special" things you put in to tell the program where the results of its search for new files should go. For those familiar with PHP, you may see that these are simply the PHP commands to display a variable or run a function. If you're not familiar with PHP, don't worry about it, just type in the values we give. Most of these are used in the file as we supply it, so you can see an example.

Note: Capitalization matters!

<?=$days?>
Number of days used for "since" value.
<?=$last?>
Date of last visit. (Or "unknown" if the date cannot be determined.)
<?newStuff()?>
List of new files. Note that this one is different from the others: it has no equal sign, and it has those parenthesis. (It's a function call, not a variable.)
<?=$fileCount?>
Number of new or changed files found

[Umm, I think you have to do the newStuff() before you can ask for a $fileCount, but I'm not sure. Check on this.]

Caveats

Whatsnew attempts to give the user a Cookie or two to record the date of last visit. If the user's browser refuses cookies, Whatsnew will not be able to tell when they last visited. This isn't fatal, as it will then fall back to a fixed number of days.

If the user makes multiple visits within a 48 hour period, Whatsnew considers the "last visit" to be the last visit that was at least 48 hours ago. (If we didn't do something like this, then if the user asked for "last 30 days", looked at this list for 10 seconds, and then asked for "since last visit", they'd only get files updated within the last 10 seconds.)

Whatsnew expects all your files to be under a single "document root", as reported by the web server. If you have multiple document roots or are using aliasing or other fancy techniques, Whatsnew won't work well for you. If you need this, well, you could try offerring us some big bucks.

Tech Support

We're giving this away for free so we really can't give you a lot of help, but if you have questions, we'll take a stab at helping you. Contact us.


Pregnant Pause Home Software Search this site

Copyright 2003 by Pregnant Pause
Contact us.