download.gp



Creator information
Current maintainer :Max Maischein
Author(s) :Max Maischein
Recipe homepage :<none>

Version history
The documentation file was last modified on Tue Feb 15 23:31:53 2000.

Overview
download.gp exports a routine to maintain the size of downloadable local files.
Compatible Genpage Versions
Version 1.0.3 and above.
Syntax
dl_file( aFilename )
dl_file( aFilename, aDescription )
dl_file( aFilename, aDescription, aFilesize )

In the simplest form, dl_file returns <A HREF="aFilename">aFilename</A>(xxx k) where xxx stands for the size of the file with the name given through aFilename in kilobytes (1024 bytes).

The form with 2 parameters returns <A HREF="aFilename">aDescription</A>(xxx k) , which is good for a "userfriendly" description.

The third form returns <A HREF="aFilename">aDescription</A>(aFilesize) , which somewhat defeats the original intention of dl_file, since all parameters are taken directly as specified by you. The use is for replacing the file size by a approximate (and useless) download time for the file or some other witty text.

aFilename must be a local URL to a file (sorry Mac users - maybe I should convert Mac paths to URLs as well - this is reserved for v2, if there is demand for it and someone can explain to me how Mac paths work). If aFilename begins with a protocol specifier ("xxx://"), then it will not be checked and the filesize used will be the word "unknown"


Examples

Include the recipe by using <!-- _GP_ recipe( "download.gp" ) -->.

For the next examples assume a file called download.content in the $root/content directory, and that ls -l download.content shows the following :

-rw-r--r-- 1 0 everyone 1867 Jun 9 21:10 download.content

Then putting <!-- _GP_ dl_file( "download.content" ) --> in your .content file will result in

<A href="download.content">download.content</A> (1 k)

which will look like this :

download.content (1 k)


Putting <!-- _GP_ dl_file( "download.content", "Download here") --> in your .content file will result in

<A href="download.content">Download here</A> (1 k)

which will look like this :
Download here (1 k)


The third form, <!-- _GP_ dl_file( "download.content", "Download here", "Under 1 minute") --> in your .content file will result in

<A href="download.content">Download here</A> (Under 1 minute)

which will look like this :
Download here (Under 1 minute)


As you see, here it would have been much more convenient not to use dl_file at all and instead code the whole thing just using the <A> tag :). There's not even the benefit of getting a warning if the file specified by aFilename is not found.


To-do List

Known Bugs
None known :)

Back to Top


This page generated using Genpage - Version: 1.0.7 on Sun May 20 22:36:36 2001

© Max Maischein
1999