download.gp
Current maintainer : | Max Maischein
|
Author(s) : | Max Maischein
|
Recipe homepage : | <none>
|
The documentation file was last modified on Tue Feb 15 23:31:53 2000.
download.gp exports a routine to maintain the size of downloadable local files.
Compatible Genpage Versions |
Version 1.0.3 and above.
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"
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.
- Maybe add path-to-URL conversion for the filenames, so that an URL like "files/download.content"
will be checked correctly even on a Macintosh. Currently, there is a conflict with the
specification of the file name/file location for HTML and the system; dl_file
takes only one parameter, which is used for both. This is convenient and should stay
that way, but dl_file should also work on non-Unix, non-Win32 systems :)
None known :)
This page generated using Genpage - Version: 1.0.7 on Sun May 20 22:36:36 2001
© Max Maischein
1999