Here's the complete text for the download you were just reading about. For those that hate to read documentation, here's a link to DOWNLOAD onlyonedir 0.3.

To return to the Downloads page, click the Downloads button at left.

onlyonedir 0.3

The onlyonedir plugin limits blosxom's display to only those entries which are located in the directory specified in the URL. For example, with these directories:
   /animals
   /animals/mammals
   /animals/mammals/rodents
   /animals/mammals/rodents/porcupines
a browser pointed to
   www.example.com/blosxom.cgi/animals/mammals
will display only the stories located directly in the /mammals directory; nothing from /rodents or /porcupines will be displayed. Similarly, if you call:
   www.example.com/blosxom.cgi/index.html
only entries located directly in your datadir will display; nothing from /animals, /mammals, /rodents, or /porcupines will appear.

NOTE
If the specified directory contains no entry files, blosxom will produce an "empty" page (no stories). You should think about using the nixie plugin or emptymessage plugin to guard against this condition.


Configuring & Installing onlyonedir

There's nothing to configure; just drop the file into your blosxom plugins folder and blog on.

Using onlyonedir

This is a very special-purpose plugin; think of it as a shorthand method for exclude-ing every directory in your blog. Don't feel disappointed if you can't think of any reason to use it ;-)

Here's an example of using the onlyonedir, excludez, and config to create a customized "welcome page"—

Let's say that you'd prefer visitors see one or two "introductory" entries when they first hit your site, instead of the normal display of blog entries. Here's your directory structure:

 /blosxom
     /Welcome.txt
     /Terms and Conditions.txt
     /Life
         /College Life
         /Married Life
         /Next Life
     /Death
         /Death of a Salesman
         /Death of a Dream
         /Death to Smoochy

Now, you want folks to see the "intro" entries only when they hit the root level of the blog; they should be hidden at all other times. And, you want folks to see only the "intro" entries when they first hit the blog; no other entries should display. Here's what to do ---

  1. Set up the exclude plugin to never display the intro entries. Your exclude file, stored at the top level of your blog, will be:
     Welcome.txt
     Terms and Conditions.txt
  2. Set up onlyonedir to load in standby mode, by naming it:
     onlyonedir_
  3. Create a top-level configuration file (or edit your existing file) with these settings:
     $path_info eq "" and $path_info_yr eq "" and $plugins{onlyonedir} = 1;
     $path_info eq "" and $path_info_yr eq "" and $plugins{exclude} = 0;

That's it. When folks first hit your blog, they'll get your "intro" articles. If they enter a date-based URL, they'll get anything but your "intro" articles.

(Cavaet: for this to work, your config plugin must run during filter(), not head(). If you use Rael's version of config, change the line: "sub head {" to: "sub filter {", and you're good to go.)

To disable onlyonedir via config file, use this line:
$onlyonedir::onlyonedir_on = 0;
(again, your config plugin must fire during filter(), not head().)

 

DOWNLOAD onlyonedir 0.3