tagging: Allow using titles in for related stories.
[matthijs/upstream/blosxom-plugins.git] / general / file
1 # Blosxom Plugin: file
2 # Author: Nelson Minar <nelson@monkey.org>
3 # Version: 20030223
4 # http://www.nelson.monkey.org/~nelson/weblog/
5 # License: Public Domain
6
7 # The file plugin loads files from a directory and defines them as
8 # variables for use in your stories. Ie: if you have a file named 
9 # "foo", then the variable $file::foo will be set to the contents
10 # of the file "foo" and will be substituted in your stories and such.
11 # Files are loaded from $plugin_dir/filedata
12
13 package file;
14
15 my $datadir;
16
17 # Startup - scan filedata dir, read files into variables
18 sub start {
19   $datadir = $blosxom::datadir . "/filedata";
20
21   if ( $datadir and opendir D, $datadir ) {
22     foreach my $f (readdir D) {
23       next unless -f "$datadir/$f";
24       open F, "$datadir/$f";
25       $$f = join('', <F>);
26       close F;
27     }
28   }
29   1;
30 }
31
32 1;