Edit Links |
TestList /
Attachlist
<< | Page list | >> This page describes the extended version of the directive Please note that this extended version of (:attachlist:) replaces
the original directive
[pmwiki.org].
Also note that the extended version behaves differently, explicitly
referring to attachments as stored in directories rather than relative to
wiki pages or groups of wiki pages.
From now on (:attachlist:) will refer to the extended version,
not the original directive.
Table of contents (hide) 1. Introduction to the directive
|
Markup | Result |
|
(:attachlist /:) |
Files in a subdirectory can also be listed:
Markup | Result |
|
(:attachlist /SiteTest:) |
We will conclude the introduction with a slightly more complicated example. The example will list sub-directories recursively and only list files containing the text 'image'. For the files that are listed, additional detail will be shown. Here is the markup of the example
(:attachlist /SiteTest recurse=yes fmt=detailed filter=svg :)
and it produces the following result:
(:attachlist /SiteTest recurse=yes fmt=detailed filter=svg :)
The rest of this page will now describe the extended version of
(:attachlist:)
in more detail.
(:attachlist:)
The directive (:attachlist:)
is used to list attachments, i.e. uploaded
files and/or directories. These attachments are assumed to be stored in
directories on the server where the wiki site is installed.
The syntax of (:attachlist:)
is as follows
(:attachlist [<options>] [<prefix>:]<dir> [<options>] :)
The directive requires a single arugment, <dir>, which is the name of
the directory for which to list attachments. In addition, (attachlist:)
accepts a variable number of options that can be placed before or after the
directory name.
The directory argument can be preceeded by an optional <prefix> that
allows listing attachments in completely unrelated directories on the wiki
server. They are intended to correspond to the InterMap prefixes
in the following sense: If a prefix uploads:
is defined, then
(:attachlist uploads:/<path>:)
should list attachments in the directory
that is linked to by uploads:/<path>
.
If a prefix is not used, (:attachlist:)
will assume a default prefix,
typically corresponding to the directory uploads/
where PmWiki is
installed.
This section describes the options of (:attachlist:)
. Please note that
the name of an option is not case sensitive, and that it is usually enough
to only give the first significant letters of each option's argument.
When an option accepts several values, the default value is denoted as strong.
Options:
fmt={simple|detailed}
(format)Detailed
means that file size etc is also shown.
recurse={yes|no}
(recursive listings)yes
, the target directory is listed recursively.
filter={|<string>}
(filter filenames)case
.
case={yes|no}
(case sensitive)case=yes
means that the filter will be case sensitive.
listdirs={yes|no}
(list directories even when not recursing)yes
, directories are listed even if their contents aren't shown.
listfiles={yes|no}
(list files)no
, files aren't listed.
itemprefix=<string>
(prefix string of each item)*
', which results in an itemized list
starting at level one. Setting itemprefix=**
results in a list
starting at level two instead.
verbose={yes|no}
(be extra verbose - for debugging)yes
, (:attachlist:)
produces
more verbose output. In practice this is only used for debugging.
noaction={yes|no}
(don't produce normal output - for debugging)yes
, (:attachlst:)
is not
actually executed but only produces diagnostic output.
In practice this is only used for debugging.
This section gives some examples of how to use directive.
In order to install this recipe, download the file
http://wiki.lyx.org/local/attachlist.php and place it for instance in your
cookbook directory. Then add something like the following to your
configuration file, e.g. local/config.php
.
include_once("$FarmD/cookbook/attachlist.php");
Next you need to configure the downloaded file appropriately to match your installation of PmWiki.
In order to set define the location of a directory that corresponds to a prefix, add something like this to your configuration file:
$IMapLocalPath['uploads:'] = '/home/lyx/www/pmwiki/uploads';
where in this example 'uploads:'
is the name of the prefix and
'/home/lyx/www/pmwiki/uploads'
is the absolute path to the corresponding
directory.
getcwd()
to set the absolute path to the upload directory? ThomasP
Lots of information that needs to be added...
$IMapLocalPath[]
Possible configuration choices (to be done...):
The implementation of (:attachlist:)
accepts several internal options
which are listed here:
$opts.fmt
$opts.recurse
$opts.filter
$opts.case
$opts.listFiles
Also see the corresponding option above.
$opts.listDirs
$opts.baseDir
$opts.baseURI
$opts.verbose
$opts.noaction
$opts.matchFcn
filter
and case
above. $opts
and $name
as arguments.
$opts.fmtItemFcn
$opts
- Options structure
$name
- Name of file or directory
$path
- Absolute path to file or directory
$dir
- Relative path to file or directory.
(:attachlist /dir/file:)
should work?
(:attachlist /dir/glob:)
should work?
(:attachlist:)
behave more like the original?